Hello,
I had to bring this thread back to life. I am trying to wake up a R.O.B. and found this. There is some good info here that I was able to get some use out of, though not yet a consistent result.
I'm taking a little different approach. I went on the notion that the refresh rate of current monitors is the issue. So I decided to try to use an Arduino to pulse an LED in the eye of R.O.B. using the info posted here. Note that the LED needs to be pointed directly into the eye. I used a yellow one, but don't have a lot of info about the other colors yet.
It works, but there are still some issues I am not sure how to solve. I was able to sort of tune the delays using an analog potentiometer until the robot responded.
The initialization part seems to work fairly well as the LED on his head flashes, and sometimes he will make a move but it is not usually what I expect. The timing of the delays may be the issue, and there is likely a better use of a timer to get consistent pulses. I hope if anyone knows AVR or Arduino they can chime in and help tighten this up.
He is responding though so there is a possibility to give an input that will use an LED to pulse the correct signals.
This is what I have right now, it's a bit messy because I am just hacking back and forth. Keep in mind there are a few different delay variables that I was experimenting with because I noticed that a delay at half the rate for the action section was causing motions. Again I am not sure if this is just a result of the timer being off
Any further help is appreciated.
int potPin0 = A0; // select the input pin for the potentiometer
int potPin1 = A1; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int delayTime =30; // variable to store LED delay 1
int delayTime2 = delayTime/2; // variable to store LED delay 2
int delayBetween = 0; // variable to store a delay between Init and Action
void setup() {
Serial.begin(9600);
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}
void loop() {
RobMove();
//delayTime = analogRead(potPin0);
//delayTime2 = analogRead(potPin0);
//delayBetween = analogRead(potPin0);
Serial.print("Delay 1: ");
Serial.println(delayTime);
Serial.print("Delay 2: ");
Serial.println(delayTime2);
Serial.print("Delay Between: ");
Serial.println(delayBetween);
Serial.println("");
delay(2000);
}
///FUNCTIONS
void RobMove ()
{
bool Init[] = {0,0,0,1,0};
bool Action[] = {1,0,1,0,1,0,1,1};
//Initialization
for (int i=0;i<sizeof(Init);i++){
if (Init[i]==0){
digitalWrite(13, LOW);
delay(delayTime);
}
else{
digitalWrite(13, HIGH);
delay(delayTime);
}
}
//delay(delayBetween);
//Action
for (int i=0;i<sizeof(Action);i++){
if (Action[i]==0){
digitalWrite(13, LOW);
delay(delayTime2);
}
else{
digitalWrite(13, HIGH);
delay(delayTime2);
}
}
//Reset LED OFF
digitalWrite(13, LOW);
}
//Other test functions
void RobCalibrate()
{
delayTime = 30;
delayTime2 = 18;
//delayTime2 = analogRead(sensorPin);
//Serial.println(delayTime2);
//----------------
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, HIGH);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
//-----------------
digitalWrite(13, HIGH);
delay(delayTime2);
digitalWrite(13, LOW);
delay(delayTime2);
digitalWrite(13, HIGH);
delay(delayTime2);
digitalWrite(13, LOW);
delay(delayTime2);
digitalWrite(13, HIGH);
delay(delayTime2);
digitalWrite(13, LOW);
delay(delayTime2);
digitalWrite(13, HIGH);
delay(delayTime2);
digitalWrite(13, HIGH);
delay(delayTime2);
//-------
}
void RobTest()
{
delayTime = 30;
// delayTime = analogRead(sensorPin);
//Serial.println(delayTime);
//----------------
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, HIGH);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
//-----------------
digitalWrite(13, HIGH);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, HIGH);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, HIGH);
delay(delayTime);
digitalWrite(13, LOW);
delay(delayTime);
digitalWrite(13, HIGH);
delay(delayTime);
digitalWrite(13, HIGH);
delay(delayTime);
//-------
}