Shop OBEX P1 Docs P2 Docs Learn Events
Code for buzzer and LCD — Parallax Forums

Code for buzzer and LCD

nic21nic21 Posts: 12
edited 2014-11-26 07:56 in General Discussion
I do not know what codes to write to activate the buzzer connect in series to p20.
Can someone advise me? Anyone know of C codes for LCD (16x2)?

int ping1; // Declare distance variable
int ping2; // Declare distance variable

int main() // main function
{

while(1) // Repeat indefinitely
{
ping1 = ping_cm(18); // Get cm distance from Ping)))
print("%c ping1 = %d%c cm", // Display distance
HOME, ping1, CLREOL);
pause(1000); // Wait 1/5 second

ping2 = ping_cm(19); // Get cm distance from Ping)))
print("%c ping2 = %d%c cm", // Display distance
HOME, ping2, CLREOL);
pause(1000); // Wait 1/5 second
if ((ping1<150)& (ping2<150))
{
//activate buzzer connected at propeller board (p20)
}

pause(1000);

}

Comments

Sign In or Register to comment.