SHARE
TWEET

arduino_control

a guest Jul 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char val;
  2. void setup() {
  3.   pinMode(2,OUTPUT);
  4.   pinMode(3,OUTPUT);
  5.   Serial.begin(9600);
  6. }
  7.  
  8. void loop() {
  9. if( Serial.available() >0 ) {
  10.     val = Serial.read();
  11.     Serial.println(val);
  12. }
  13.        if( val == '1' ) {
  14.     digitalWrite(2,HIGH); }
  15.   else if( val == '2' ) {
  16.     digitalWrite(3,HIGH); }
  17.    
  18.   else if( val == 'A' ) {
  19.     digitalWrite(2,LOW); }
  20.   else if( val == 'B' ) {
  21.     digitalWrite(3,LOW); }
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top