diff options
Diffstat (limited to 'CODE')
| -rw-r--r-- | CODE/CODE.ino | 38 | ||||
| -rw-r--r-- | CODE/debug/IR/IR_sens/IR_sens.ino (renamed from CODE/debug/IR/IR_sens/IR_sens1.ino) | 4 | ||||
| -rw-r--r-- | CODE/debug/IR/communication/direct_rx/direct_rx.ino | 15 | ||||
| -rw-r--r-- | CODE/debug/IR/communication/rx_teensy/rx_teensy.ino | 6 | ||||
| -rw-r--r-- | CODE/debug/IR/communication/tx_seeed/tx_seeed.ino | 2 | ||||
| -rw-r--r-- | CODE/debug/IR/teensydeco/teensydeco.ino | 6 | ||||
| -rw-r--r-- | CODE/debug/color/Blink.txt | 1 |
7 files changed, 46 insertions, 26 deletions
diff --git a/CODE/CODE.ino b/CODE/CODE.ino index 6b07d67..0d225a4 100644 --- a/CODE/CODE.ino +++ b/CODE/CODE.ino @@ -94,7 +94,7 @@ void setup() { pinMode(pr8, INPUT); Serial.begin(9600); - Serial1.begin(9600); + Serial3.begin(9600); Serial2.begin(9600); Timer3.initialize(800); // 800 microseconds / 1.25kHz @@ -152,24 +152,24 @@ void mcpsoftpwm1(int value1) { if (value1 < 0) value1 = 0; if (value1 > 100) value1 = 100; - Serial.print("softPWM pin: 3, value: "); - Serial.println(value1); + //Serial.print("softPWM pin: 3, value: "); + //Serial.println(value1); PWMval1 = value1; } void mcpsoftpwm2(int value2) { if (value2 < 0) value2 = 0; if (value2 > 100) value2 = 100; - Serial.print("softPWM pin: 3, value: "); - Serial.println(value2); + //Serial.print("softPWM pin: 3, value: "); + //Serial.println(value2); PWMval2 = value2; } void mcpsoftpwm3(int value3) { if (value3 < 0) value3 = 0; if (value3 > 100) value3 = 100; - Serial.print("softPWM pin: 3, value: "); - Serial.println(value3); + //Serial.print("softPWM pin: 3, value: "); + //Serial.println(value3); PWMval3 = value3; } @@ -190,8 +190,8 @@ void drive(int speed, int direction){ digitalWrite(m1enB, LOW); digitalWrite(m2enB, LOW); digitalWrite(m3enB, LOW); - Serial.println("debug2"); - Serial.println(direction); + //Serial.println("debug2"); + //Serial.println(direction); if(direction>330 || direction<=30){ //0 deg digitalWrite(m1pwm1, LOW); @@ -202,10 +202,10 @@ void drive(int speed, int direction){ digitalWrite(m3pwm1, LOW); digitalWrite(m3pwm2, HIGH); - Serial.println("0 deg"); + //Serial.println("0 deg"); }else if (direction>30 && direction <= 90){ //60 deg - Serial.println("60deg"); + //Serial.println("60deg"); digitalWrite(m1pwm1, LOW); digitalWrite(m1pwm2, LOW); @@ -216,7 +216,7 @@ void drive(int speed, int direction){ digitalWrite(m3pwm2, HIGH); }else if (direction>90 && direction <= 150){ //120 deg - Serial.println("120 deg"); + //Serial.println("120 deg"); digitalWrite(m1pwm1, HIGH); digitalWrite(m1pwm2, LOW); digitalWrite(m2pwm1, HIGH); @@ -225,7 +225,7 @@ void drive(int speed, int direction){ digitalWrite(m3pwm2, LOW); }else if (direction > 150 && direction <= 210) { //180 degrees - Serial.println("on 180"); + //Serial.println("on 180"); digitalWrite(m1pwm1, HIGH); digitalWrite(m1pwm2, LOW); @@ -250,7 +250,7 @@ void drive(int speed, int direction){ digitalWrite(m1pwm2, HIGH); digitalWrite(m2pwm1, LOW); digitalWrite(m2pwm2, HIGH); - Serial.println("300deg"); + //Serial.println("drive 300deg"); digitalWrite(m3pwm1, LOW); digitalWrite(m3pwm2, LOW); }else{ @@ -287,8 +287,8 @@ void loop() { }else if (dpr8 == HIGH){ //go back to ?deg }else{ - if (Serial1.available() > 0) { - incomingbyte1 = Serial1.read(); + if (Serial3.available() > 0) { + incomingbyte1 = Serial3.read(); //Serial.print(char(incomingbyte1)); if (incomingbyte1 == 's'){ iswriting1 = true; @@ -318,6 +318,10 @@ void loop() { //Serial.println(locdat); sscanf(locdat1.c_str(), "%d, %d", &nir1, &pir1); sscanf(locdat2.c_str(), "%d, %d", &nir2, &pir2); + + Serial.print("locdat: "); + Serial.print(String(locdat1)); + Serial.println(String(locdat2)); if(pir1 > pir2){ @@ -357,6 +361,8 @@ void loop() { degwhere = 337.5; } } + + Serial.print("Ball is at "); Serial.print(degwhere); Serial.println(" degrees."); drive(75, degwhere); diff --git a/CODE/debug/IR/IR_sens/IR_sens1.ino b/CODE/debug/IR/IR_sens/IR_sens.ino index df4a5fc..85089d4 100644 --- a/CODE/debug/IR/IR_sens/IR_sens1.ino +++ b/CODE/debug/IR/IR_sens/IR_sens.ino @@ -94,7 +94,7 @@ void loop() { Serial.print(", ir 7 changes: "); Serial.print(IRcount7); Serial.print(", ir 8 changes: "); - Serial.print(IRcount8); + Serial.println(IRcount8); Serial1.print("ir 1 changes: "); Serial1.print(IRcount1); @@ -113,7 +113,7 @@ void loop() { Serial1.print(", ir 8 changes: "); Serial1.print(IRcount8); - volatile long IRcounts[] = {IRcount1, IRcount2, IRcount3, IRcount4, IRcount5, IRcount6, IRcount7, IRcount8}; + volatile long IRcounts[] = {IRcount1, IRcount2, IRcount3, IRcount4, IRcount5, IRcount6, IRcount7, IRcount8}; long maxCount = IRcounts[0]; int highessensor = 1; for (int i = 0; i < 7; ++i) { diff --git a/CODE/debug/IR/communication/direct_rx/direct_rx.ino b/CODE/debug/IR/communication/direct_rx/direct_rx.ino new file mode 100644 index 0000000..336b27b --- /dev/null +++ b/CODE/debug/IR/communication/direct_rx/direct_rx.ino @@ -0,0 +1,15 @@ +int incomingbyte = 0; +void setup() { + Serial.begin(9600); + Serial2.begin(9600); //19200 + Serial3.begin(9600); //19200 + Serial.print("Starting ...."); +} + +void loop() { + if (Serial3.available() > 0) { + incomingbyte = Serial3.read(); + Serial.print(char(incomingbyte)); + } + +} diff --git a/CODE/debug/IR/communication/rx_teensy/rx_teensy.ino b/CODE/debug/IR/communication/rx_teensy/rx_teensy.ino index 96e14eb..68a768b 100644 --- a/CODE/debug/IR/communication/rx_teensy/rx_teensy.ino +++ b/CODE/debug/IR/communication/rx_teensy/rx_teensy.ino @@ -6,12 +6,12 @@ int nir = "-99"; // which ir sensor it is int pir = "-99"; // amount of pulses it had void setup() { Serial.begin(9600); - Serial1.begin(9600); //19200 + Serial3.begin(9600); //19200 } void loop() { - if (Serial1.available() > 0) { - incomingbyte = Serial1.read(); + if (Serial3.available() > 0) { + incomingbyte = Serial3.read(); //Serial.print(char(incomingbyte)); if (incomingbyte == 's'){ iswriting = true; diff --git a/CODE/debug/IR/communication/tx_seeed/tx_seeed.ino b/CODE/debug/IR/communication/tx_seeed/tx_seeed.ino index c77e618..dc2d2e9 100644 --- a/CODE/debug/IR/communication/tx_seeed/tx_seeed.ino +++ b/CODE/debug/IR/communication/tx_seeed/tx_seeed.ino @@ -10,7 +10,7 @@ void setup() { } void loop() { - randNumber1 = random(999); + randNumber1 = random(1000); randNumber2 = random(1, 8); Serial1.print("s"); Serial1.print(randNumber2); diff --git a/CODE/debug/IR/teensydeco/teensydeco.ino b/CODE/debug/IR/teensydeco/teensydeco.ino index 2d06af9..f8fe2a5 100644 --- a/CODE/debug/IR/teensydeco/teensydeco.ino +++ b/CODE/debug/IR/teensydeco/teensydeco.ino @@ -16,13 +16,13 @@ float degwhere = -99.0; // where the ball is in degrees void setup() { Serial.begin(9600); - Serial1.begin(9600); + Serial3.begin(9600); Serial2.begin(9600); } void loop() { - if (Serial1.available() > 0) { - incomingbyte1 = Serial1.read(); + if (Serial3.available() > 0) { + incomingbyte1 = Serial3.read(); //Serial.print(char(incomingbyte1)); if (incomingbyte1 == 's'){ iswriting1 = true; diff --git a/CODE/debug/color/Blink.txt b/CODE/debug/color/Blink.txt deleted file mode 100644 index 0626334..0000000 --- a/CODE/debug/color/Blink.txt +++ /dev/null @@ -1 +0,0 @@ -Turn an LED on and off.
\ No newline at end of file |
