Ignore:
Timestamp:
11/15/12 10:11:08 (8 years ago)
Author:
AzureViolin <zhanghaotz@…>
Branches:
master, RawEEG, Raw_EEG_Plot, Servo, Tab_Interface, pyramid
Children:
8c73fb4, 8e852bb
Parents:
30bc659 (diff), 4af2eca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Arduino Code for Uno published for instructables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arduino/puzzlebox_orbit_Uno_V3/puzzlebox_orbit_Uno_V3.ino

    r30bc659 r08d64cc  
    107107} 
    108108 
     109void setThrottle() { 
     110   
     111  char inByte=0; 
     112  int a=0; 
     113  int b=0; 
     114  int c=0; 
     115  int newThrottle=0; 
     116   
     117  while (Serial.available() == 0); 
     118  inByte = Serial.read() - '0'; 
     119  //Serial.println(inByte); 
     120  a = inByte; 
     121   
     122  while (Serial.available() == 0); 
     123  inByte = Serial.read() - '0'; 
     124  //Serial.println(inByte); 
     125  b = inByte; 
     126   
     127  while (Serial.available() == 0); 
     128  inByte = Serial.read() - '0'; 
     129  //Serial.println(inByte); 
     130  c = inByte; 
     131   
     132  newThrottle = (a * 100) + (b * 10) + c; 
     133   
     134  if (newThrottle < 0) 
     135    newThrottle=0; 
     136   
     137  if (newThrottle > 100) 
     138    newThrottle=100; 
     139     
     140  _throttle=newThrottle; 
     141   
     142  Serial.print("_throttle="); 
     143  Serial.println(int(_throttle)); 
     144   
     145} 
     146 
    109147void loop() 
    110148{int i; 
     
    122160      case 'F':  _pitch+=5;  Serial.print("_pitch="); Serial.println(int(_pitch)); break; 
    123161      case 'B':  _pitch-=5;  Serial.print("_pitch="); Serial.println(int(_pitch)); break; 
     162<<<<<<< HEAD 
    124163      case '1':  _channel='A';  Serial.println("_channel=A"); break; 
    125164      case '2':  _channel='B';  Serial.println("_channel=B"); break; 
    126165      case '3':  _channel='C';  Serial.println("_channel=C"); break; 
     166======= 
     167      case '1':  _channel='A';  Serial.print("_channel=A"); break; 
     168      case '2':  _channel='B';  Serial.print("_throttle=B"); break; 
     169      case '3':  _channel='C';  Serial.print("_throttle=C"); break; 
     170      case 'x':  setThrottle(); break; 
     171>>>>>>> 4af2eca0d67b030ccd9d3fa1d0caa07e6c6aa26e 
    127172    } 
    128173  } 
Note: See TracChangeset for help on using the changeset viewer.