1
0
Fork 0
mirror of https://github.com/RobotechLille/cdf2018-principal synced 2024-11-14 04:16:05 +01:00

Update code Arduino

Robotech again
This commit is contained in:
Geoffrey Frogeye 2018-05-09 10:10:04 +02:00
parent 4195842e85
commit 8813455901
2 changed files with 20 additions and 13 deletions

View file

@ -13,7 +13,8 @@ Servo servoPoussoir;
int pinservoLoquet = 7; int pinservoLoquet = 7;
int pinservoPositionBalle = 8; int pinservoPositionBalle = 8;
int pinservoPoussoir = 6; int pinservoPoussoir = 6;
int relai = 10; int relai_IN1 = 9;
int relai_IN2 = 10;
int pos_initial = 512; int pos_initial = 512;
int pos_max = 960; int pos_max = 960;
int pos_min = 40; int pos_min = 40;
@ -27,7 +28,8 @@ void setup()
servoLoquet.attach(pinservoLoquet); servoLoquet.attach(pinservoLoquet);
servoPositionBalle.attach(pinservoPositionBalle); servoPositionBalle.attach(pinservoPositionBalle);
servoPoussoir.attach(pinservoPoussoir); servoPoussoir.attach(pinservoPoussoir);
pinMode(relai, OUTPUT); pinMode(relai_IN1, OUTPUT);
pinMode(relai_IN2, OUTPUT);
} }
void barilletUnCran() void barilletUnCran()
@ -74,40 +76,45 @@ void loop()
break; break;
case 'A': // Position attente balle case 'A': // Position attente balle
servoPositionBalle.write(70); servoPositionBalle.write(70);
//delay(2000); delay(500);
break; break;
case 'V': // Position évacuation balle case 'V': // Position évacuation balle
servoPositionBalle.write(0); servoPositionBalle.write(0);
//delay(2000); delay(500);
break;
case 'J': // Position éjection balle
servoPositionBalle.write(180);
//delay(2000);
break; break;
case 'O': // Pousser balle case 'O': // Pousser balle
// Position basse // Position basse
servoPoussoir.write(0); servoPoussoir.write(0);
delay(1000); //delay(500);
// Position haute // Position haute
servoPoussoir.write(120); servoPoussoir.write(120);
delay(1000); delay(1000);
break; break;
case 'B': // Tourner barillet d'un cran case 'B': // Tourner barillet d'un cran
barilletUnCran(); barilletUnCran();
delay(500);
break; break;
case 'H': // Tourner de deux crans case 'H': // Tourner de deux crans
barilletDeuxCrans(); barilletDeuxCrans();
delay(500);
break; break;
case 'R': // Reset barillet case 'R': // Reset barillet
// ax12a.setEndless(ID, OFF); // ax12a.setEndless(ID, OFF);
ax12a.setEndless(ID, ON); ax12a.setEndless(ID, ON);
ax12a.turn(ID, LEFT, 0); ax12a.turn(ID, LEFT, 0);
ax12a.setEndless(ID, OFF);
ax12a.move(ID, pos_initial);
delay(500);
break; break;
case 'T': // Propulsion on case 'T': // Propulsion on
digitalWrite(relai, HIGH); digitalWrite(relai_IN1, HIGH);
digitalWrite(relai_IN2, LOW);
//delay(4000);
break; break;
case 'U': // Propulsion off case 'U': // Propulsion off
digitalWrite(relai, LOW); digitalWrite(relai_IN1, LOW);
digitalWrite(relai_IN2, HIGH);
//delay(4000);
break; break;
case 'P': // Ping case 'P': // Ping
break; break;
@ -122,4 +129,4 @@ void loop()
Serial.write(lettre); Serial.write(lettre);
} }
} }
} }

View file

@ -97,7 +97,7 @@ upgrade-overlays: sshconf
# ARDUINO # ARDUINO
upgrade-arduino: upgrade-arduino:
make -C ../arduino/ make -C ../arduino/
scp -F sshconf -q "../arduino/principal.hex" principal:/tmp/principal.hex scp -F sshconf -q "../arduino/build/main.hex" principal:/tmp/principal.hex
ssh -F sshconf principal "avrdude -p atmega2560 -P /dev/ttyACM0 -c stk500 -D -U flash:w:/tmp/principal.hex" ssh -F sshconf principal "avrdude -p atmega2560 -P /dev/ttyACM0 -c stk500 -D -U flash:w:/tmp/principal.hex"
# FPGA # FPGA