daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jun 17th, 2014 198 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. int val;
  3. void setup() {
  4.   Serial.begin(9600);  
  5.   //Setup Channel A
  6.   pinMode(12, OUTPUT); //Initiates Motor Channel A pin
  7.   pinMode(9, OUTPUT); //Initiates Brake Channel A pin
  8.    pinMode(13, OUTPUT); //Initiates Motor Channel Bpin
  9.     pinMode(8, OUTPUT); //Initiates Brake Channel A pin
  10. }
  11.  
  12. void loop()
  13. {
  14.   if (Serial.available()) {         //[ch1077][ch1089][ch1083][ch1080] [ch1077][ch1089][ch1090][ch1100] [ch1087][ch1088][ch1080][ch1085][ch1103][ch1090][ch1099][ch1081] [ch1089][ch1080][ch1084][ch1074][ch1086][ch1083],
  15.     val = Serial.read();            //  [ch1090][ch1086] [ch1095][ch1080][ch1090][ch1072][ch1077][ch1084] [ch1077][ch1075][ch1086] [ch1080] [ch1089][ch1086][ch1093][ch1088][ch1072][ch1085][ch1103][ch1077][ch1084] [ch1074] val
  16.    
  17.     if (val == '8')
  18.     {          
  19.        //forward @ full speed
  20.   digitalWrite(12, HIGH); //Establishes forward direction of Channel A
  21.   digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  22.   analogWrite(3, 255);   //Spins the motor on Channel A at full speed
  23.  
  24.  
  25.  
  26.   delay(250);
  27.     }
  28.  
  29. }
  30. if (val == '2')
  31.     {          
  32.   digitalWrite(12, LOW); //Establishes backward direction of Channel A
  33.   digitalWrite(9, LOW);   //Disengage the Brake for Channel A
  34.   analogWrite(3, 255);   //Spins the motor on Channel A at half speed
  35.  
  36.  
  37.  
  38.   delay(250);
  39.     }
  40.    
  41.     if (val == '5')
  42.     {          
  43.   digitalWrite(12, HIGH); //Establishes backward direction of Channel A
  44.   digitalWrite(9, HIGH);   //Disengage the Brake for Channel A
  45.   analogWrite(3, 255);   //Spins the motor on Channel A at half speed
  46.   digitalWrite(13, HIGH); //Establishes backward direction of Channel A
  47.   digitalWrite(8, HIGH);   //Disengage the Brake for Channel A
  48.   analogWrite(11, 255);   //Spins the motor on Channel A at half speed
  49.  
  50.  
  51.   delay(250);
  52.     }
  53.    
  54.    
  55.     if (val == '4')
  56.     {          
  57.   digitalWrite(13, HIGH); //Establishes backward direction of Channel A
  58.   digitalWrite(8, LOW);   //Disengage the Brake for Channel A
  59.   analogWrite(11, 255);   //Spins the motor on Channel A at half speed
  60.  
  61.  
  62.  
  63.   delay(250);
  64.     }
  65.    
  66.      if (val == '6')
  67.     {          
  68.   digitalWrite(13, LOW); //Establishes backward direction of Channel A
  69.   digitalWrite(8, LOW);   //Disengage the Brake for Channel A
  70.   analogWrite(11, 255);   //Spins the motor on Channel A at half speed
  71.  
  72.  
  73.  
  74.   delay(250);
  75.     }
  76.    
  77.    
  78.    
  79.    
  80.    
  81.    
  82.    
  83.  
  84. }
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