Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // http://labdegaragem.com/forum/topics/problemas-ao-acionar-motor-via-serial-e-xbee
- int ledPin = 13; // Set the pin to digital I/O
- int valor_sensor = 0;
- int captura_buffer = 0;
- //------------------------------
- void setup()
- {
- pinMode(ledPin, OUTPUT);
- pinMode(A1, INPUT);//sensor pressão
- Serial.begin(9600);
- }
- //-------------------------------
- void loop()
- {
- digitalWrite(ledPin, HIGH);
- valor_sensor = analogRead(A1);
- Serial.println(valor_sensor);
- while (Serial.available() > 0)
- {
- captura_buffer = Serial.read(); // Lê byte do buffer serial;
- Serial.println(captura_buffer);
- if (captura_buffer > 8)
- {
- digitalWrite(ledPin, LOW);
- }
- }
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement