Difference between revisions of "CRITR/Arm Control gen2"
From Lofaro Lab Wiki
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | Notes : | |
+ | *The codes below are for controller; Robot code is same as Generation 1. | ||
+ | *Micro-controller, Pro-mini, is used for the second generation arm controller. | ||
+ | *Each Pro-mini has 8 analog pin, therefore 3 Pro-mini is used. | ||
+ | |||
+ | |||
+ | =Micro-controller_1= | ||
* 8 potentiometers are connected, and has id number 1 through 6 of arm(analog pin 3 to 8 respectively) | * 8 potentiometers are connected, and has id number 1 through 6 of arm(analog pin 3 to 8 respectively) | ||
* Tx of Micro_controller_1 connects to Rx of Micro-controller_2 | * Tx of Micro_controller_1 connects to Rx of Micro-controller_2 | ||
Line 24: | Line 30: | ||
} | } | ||
− | = | + | =Micro-controller_2= |
* 6 potentiometers are connected, and has id number 7 through 12 of arm(analog pin 1 to 6 respectively) | * 6 potentiometers are connected, and has id number 7 through 12 of arm(analog pin 1 to 6 respectively) | ||
* Rx of Micro_controller_2 connects to Tx of Micro-controller_1 | * Rx of Micro_controller_2 connects to Tx of Micro-controller_1 | ||
Line 56: | Line 62: | ||
} | } | ||
− | = | + | =Micro-controller_3= |
* This Micro-controller connects to field computer using FTDI-device | * This Micro-controller connects to field computer using FTDI-device | ||
* 6 potentiometers are connected, and has id number 13 through 18 of arm(analog pin 1 to 6 respectively) | * 6 potentiometers are connected, and has id number 13 through 18 of arm(analog pin 1 to 6 respectively) |
Latest revision as of 18:01, 8 December 2015
Notes :
- The codes below are for controller; Robot code is same as Generation 1.
- Micro-controller, Pro-mini, is used for the second generation arm controller.
- Each Pro-mini has 8 analog pin, therefore 3 Pro-mini is used.
Micro-controller_1
- 8 potentiometers are connected, and has id number 1 through 6 of arm(analog pin 3 to 8 respectively)
- Tx of Micro_controller_1 connects to Rx of Micro-controller_2
int pos[8]; char str[16]; char Base_36_Table[36] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; void setup() { Serial.begin(250000); delay(100); } void loop() { int i=0; int id = 0; for (int i=0; i<8; i++){ pos[i] = analogRead(i); str[id++] = Base_36_Table[pos[i]/36]; str[id++] = Base_36_Table[pos[i]%36]; } for(int i=0; i<16; i++){ Serial.write(str[i]); } Serial.println(""); delay(80); }
Micro-controller_2
- 6 potentiometers are connected, and has id number 7 through 12 of arm(analog pin 1 to 6 respectively)
- Rx of Micro_controller_2 connects to Tx of Micro-controller_1
- Tx of Micro_controller_2 connects to Rx of Micro-controller_3
int pos[8]; char str[40]; char Base_36_Table[36] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; void setup() { Serial.begin(250000); } void loop() { int i=0; if(Serial.available()){ while(Serial.available()){ str[i++] = Serial.read(); delay(1); } } i=0; int id = 16; for (int i=0; i<6; i++){ pos[i] = analogRead(i); str[id++] = Base_36_Table[pos[i]/36]; str[id++] = Base_36_Table[pos[i]%36]; } for(int i=0; i<28; i++){ Serial.write(str[i]); } Serial.println(""); delay(80); }
Micro-controller_3
- This Micro-controller connects to field computer using FTDI-device
- 6 potentiometers are connected, and has id number 13 through 18 of arm(analog pin 1 to 6 respectively)
- Rx of Micro_controller_3 connects to Tx of Micro-controller_2
int pos[8]; char str[40]; char Base_36_Table[36] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; void setup() { Serial.begin(250000); } void loop() { int i=0; if(Serial.available()){ while(Serial.available()){ str[i++] = Serial.read(); delay(1); } } i=0; int id = 28; for (int i=0; i<6; i++){ pos[i] = analogRead(i); str[id++] = Base_36_Table[pos[i]/36]; str[id++] = Base_36_Table[pos[i]%36]; } for(int i=0; i<40; i++){ Serial.write(str[i]); } //Serial.println(""); delay(80); }