

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Two arduino code examples for handling input from serial and buttons. The first example reads characters from serial and prints corresponding messages. The second example uses digital pins for buttons and leds, and the code turns on the led when the corresponding button is pressed. Students can use these examples as a starting point for their own arduino projects.
Typology: Essays (high school)
1 / 3
This page cannot be seen from the preview
Don't miss anything!


char prog; void setup() { Serial.begin(9600); } void loop() { if (Serial.available()) { prog = Serial.read(); switch (prog) { case 'A': Serial.println("A letra A foi digitada"); break; case 'B': Serial.println("A letra B foi digitada"); break; case 'C': Serial.println("A letra C foi digitada"); break; case 'a': Serial.println("A letra a foi digitada"); break; case 'b': Serial.println("A letra b foi digitada"); break; case 'c': Serial.println("A letra c foi digitada"); break; } } }