mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Fixed robot libraries and examples for unified Arduino core
This commit is contained in:
@ -5,9 +5,9 @@
|
||||
reads/writes from/to them. Uncomment the different lines inside
|
||||
the loop to test the different possibilities.
|
||||
|
||||
The TK inputs on the Control Board are multiplexed and therefore
|
||||
it is not recommended to use them as outputs. The TKD pins on the
|
||||
Control Board as well as the TK pins on the Motor Board go directly
|
||||
The M inputs on the Control Board are multiplexed and therefore
|
||||
it is not recommended to use them as outputs. The D pins on the
|
||||
Control Board as well as the D pins on the Motor Board go directly
|
||||
to the microcontroller and therefore can be used both as inputs
|
||||
and outputs.
|
||||
|
||||
@ -25,9 +25,9 @@
|
||||
#include <ArduinoRobot.h>
|
||||
|
||||
// use arrays to store the names of the pins to be read
|
||||
uint8_t arr[] = { TK0, TK1, TK2, TK3, TK4, TK5, TK6, TK7 };
|
||||
uint8_t arr2[] = { TKD0, TKD1, TKD2, TKD3, TKD4, TKD5 };
|
||||
uint8_t arr3[] = { B_TK1, B_TK2, B_TK3, B_TK4 };
|
||||
uint8_t arr[] = { M0, M1, M2, M3, M4, M5, M6, M7 };
|
||||
uint8_t arr2[] = { D0, D1, D2, D3, D4, D5 };
|
||||
uint8_t arr3[] = { D7, D8, D9, D10 };
|
||||
|
||||
void setup(){
|
||||
// initialize the robot
|
||||
@ -38,34 +38,34 @@ void setup(){
|
||||
}
|
||||
|
||||
void loop(){
|
||||
// read all the TK inputs at the Motor Board as analog
|
||||
analogReadB_TKs();
|
||||
// read all the D inputs at the Motor Board as analog
|
||||
//analogReadB_Ds();
|
||||
|
||||
// read all the TK inputs at the Motor Board as digital
|
||||
//digitalReadB_TKs();
|
||||
// read all the D inputs at the Motor Board as digital
|
||||
//digitalReadB_Ds();
|
||||
|
||||
// read all the TK inputs at the Control Board as analog
|
||||
//analogReadTKs();
|
||||
// read all the M inputs at the Control Board as analog
|
||||
//analogReadMs();
|
||||
|
||||
// read all the TK inputs at the Control Board as digital
|
||||
//digitalReadTKs();
|
||||
// read all the M inputs at the Control Board as digital
|
||||
//digitalReadMs();
|
||||
|
||||
// read all the TKD inputs at the Control Board as analog
|
||||
//analogReadTKDs();
|
||||
// read all the D inputs at the Control Board as analog
|
||||
analogReadT_Ds();
|
||||
|
||||
// read all the TKD inputs at the Control Board as digital
|
||||
//digitalReadTKDs();
|
||||
// read all the D inputs at the Control Board as digital
|
||||
//digitalReadT_Ds();
|
||||
|
||||
// write all the TK outputs at the Motor Board as digital
|
||||
//digitalWriteB_TKs();
|
||||
// write all the D outputs at the Motor Board as digital
|
||||
//digitalWriteB_Ds();
|
||||
|
||||
// write all the TKD outputs at the Control Board as digital
|
||||
//digitalWriteTKDs();
|
||||
delay(5);
|
||||
// write all the D outputs at the Control Board as digital
|
||||
//digitalWriteT_Ds();
|
||||
delay(40);
|
||||
}
|
||||
|
||||
// read all TK inputs on the Control Board as analog inputs
|
||||
void analogReadTKs() {
|
||||
// read all M inputs on the Control Board as analog inputs
|
||||
void analogReadMs() {
|
||||
for(int i=0;i<8;i++) {
|
||||
Serial.print(Robot.analogRead(arr[i]));
|
||||
Serial.print(",");
|
||||
@ -73,8 +73,8 @@ void analogReadTKs() {
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
// read all TK inputs on the Control Board as digital inputs
|
||||
void digitalReadTKs() {
|
||||
// read all M inputs on the Control Board as digital inputs
|
||||
void digitalReadMs() {
|
||||
for(int i=0;i<8;i++) {
|
||||
Serial.print(Robot.digitalRead(arr[i]));
|
||||
Serial.print(",");
|
||||
@ -82,8 +82,8 @@ void digitalReadTKs() {
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
// read all TKD inputs on the Control Board as analog inputs
|
||||
void analogReadTKDs() {
|
||||
// read all D inputs on the Control Board as analog inputs
|
||||
void analogReadT_Ds() {
|
||||
for(int i=0; i<6; i++) {
|
||||
Serial.print(Robot.analogRead(arr2[i]));
|
||||
Serial.print(",");
|
||||
@ -91,8 +91,8 @@ void analogReadTKDs() {
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
// read all TKD inputs on the Control Board as digital inputs
|
||||
void digitalReadTKDs() {
|
||||
// read all D inputs on the Control Board as digital inputs
|
||||
void digitalReadT_Ds() {
|
||||
for(int i=0; i<6; i++) {
|
||||
Serial.print(Robot.digitalRead(arr2[i]));
|
||||
Serial.print(",");
|
||||
@ -100,8 +100,8 @@ void digitalReadTKDs() {
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
// write all TKD outputs on the Control Board as digital outputs
|
||||
void digitalWriteTKDs() {
|
||||
// write all D outputs on the Control Board as digital outputs
|
||||
void digitalWriteT_Ds() {
|
||||
// turn all the pins on
|
||||
for(int i=0; i<6; i++) {
|
||||
Robot.digitalWrite(arr2[i], HIGH);
|
||||
@ -115,8 +115,8 @@ void digitalWriteTKDs() {
|
||||
delay(500);
|
||||
}
|
||||
|
||||
// write all TK outputs on the Motor Board as digital outputs
|
||||
void digitalWriteB_TKs() {
|
||||
// write all D outputs on the Motor Board as digital outputs
|
||||
void digitalWriteB_Ds() {
|
||||
// turn all the pins on
|
||||
for(int i=0; i<4; i++) {
|
||||
Robot.digitalWrite(arr3[i], HIGH);
|
||||
@ -130,8 +130,8 @@ void digitalWriteB_TKs() {
|
||||
delay(500);
|
||||
}
|
||||
|
||||
// read all TK inputs on the Motor Board as analog inputs
|
||||
void analogReadB_TKs() {
|
||||
// read all D inputs on the Motor Board as analog inputs
|
||||
void analogReadB_Ds() {
|
||||
for(int i=0; i<4; i++) {
|
||||
Serial.print(Robot.analogRead(arr3[i]));
|
||||
Serial.print(",");
|
||||
@ -139,8 +139,8 @@ void analogReadB_TKs() {
|
||||
Serial.println("");
|
||||
}
|
||||
|
||||
// read all TKD inputs on the Motor Board as digital inputs
|
||||
void digitalReadB_TKs() {
|
||||
// read all D inputs on the Motor Board as digital inputs
|
||||
void digitalReadB_Ds() {
|
||||
for(int i=0; i<4; i++) {
|
||||
Serial.print(Robot.digitalRead(arr3[i]));
|
||||
Serial.print(",");
|
||||
|
@ -23,7 +23,7 @@ void setup() {
|
||||
Robot.begin();
|
||||
|
||||
// initialize the robot's screen
|
||||
Robot.beginLCD();
|
||||
Robot.beginTFT();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@ -31,14 +31,14 @@ void loop() {
|
||||
value=Robot.analogRead(TK4);
|
||||
|
||||
// write the sensor value on the screen
|
||||
Robot.fill(0, 255, 0);
|
||||
Robot.stroke(0, 255, 0);
|
||||
Robot.textSize(1);
|
||||
Robot.text(value, 0, 0);
|
||||
|
||||
delay(500);
|
||||
|
||||
// erase the previous text on the screen
|
||||
Robot.fill(255, 255, 255);
|
||||
Robot.stroke(255, 255, 255);
|
||||
Robot.textSize(1);
|
||||
Robot.text(value, 0, 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user