Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- SoftwareSerial BTSerial(0, 1); // RX | TX
- int backFront = 3;
- int backBack = 2;
- int frontLeft = 5;
- int frontRight = 6;
- void setup(){
- pinMode(backFront, OUTPUT);
- pinMode(backBack, OUTPUT);
- pinMode(frontLeft, OUTPUT);
- pinMode(frontRight, OUTPUT);
- Serial.begin(9600);
- BTSerial.begin(38400);
- }
- void loop(){
- char input;
- if (Serial.available()>0){
- input = Serial.read();
- Serial.write(input);
- }
- if (input == 'u' || input == 'U'){
- digitalWrite(backFront, HIGH);
- }
- if (input == 'd' || input == 'D'){
- digitalWrite(backBack, HIGH);
- }
- if (input == 'l' || input == 'L'){
- digitalWrite(frontLeft, HIGH);
- }
- if (input == 'r' || input == 'R'){
- digitalWrite(frontRight, HIGH);
- }
- delay(300);
- digitalWrite(backFront, LOW);
- digitalWrite(backBack, LOW);
- digitalWrite(frontLeft, LOW);
- digitalWrite(frontRight, LOW);
- }
Add Comment
Please, Sign In to add comment