GroG could you take a look at this
when you have the time
i need some setSampleRate on serial1 and serial2
i don't know how to code it
is this even possible on a serial port?
it would be nice if you could help me
Symptoms of the problem are :
#file : home/Markus/Skin.py edit rawfrom time import sleep
from org.myrobotlab.service import Speech
from org.myrobotlab.framework import MRLListener
# this subscribe is easy shorthand method
# Name it "speech".
speech = Runtime.create("speech","Speech")
speech.startService()
speech.setGoogleURI("http://thehackettfamily.org/Voice_api/api2.php?voice=Laura&txt=")
serial1 = Runtime.start('serial1','Serial')
serial2 = Runtime.start('serial2','Serial')
speech.speak("hello")
serial1.connect('COM8')
serial2.connect('COM6')
# python.subscribe('serial1','publishRX')
# python.subscribe('serial2','publishRX')
# this subscribe with 4 parameters has all details - subscribe to and callback info
# we subscribe to one service's topic to one method and the other to a different method
# this is how its done in latest mrl - nice no ?
# python.subscribe('serial1','publishRX', python.getName(), 'serial1RX')
# python.subscribe('serial2','publishRX', python.getName(), 'serial2RX')
# this is how its done in 119
listener1 = MRLListener('publishRX', 'python', 'serial1RX', None)
serial1.addListener(listener1)
listener2 = MRLListener('publishRX', 'python', 'serial2RX', None)
serial2.addListener(listener2)
# i want this to be the data from serial1
def serial1RX(data):
print(data)
num = data
#num = chr(data)
#print(num)
if (num == 1):
speech.speak("1")
if (num == 2):
speech.speak("2")
if (num == 3):
speech.speak("3")
if (num == 4):
speech.speak("4")
if (num == 5):
speech.speak("5")
if (num == 6):
speech.speak("6")
if (num == 7):
speech.speak("7")
if (num == 8):
speech.speak("8")
if (num == 9):
speech.speak("9")
if (num == 10):
speech.speak("10")
if (num == 11):
speech.speak("11")
if (num == 12):
speech.speak("12")
# and this to be the data from serial2
def serial2RX(data):
print(data)
num = data
#num = chr(data)
#print(num)
if (num == 1):
speech.speak("1")
if (num == 2):
speech.speak("2")
if (num == 3):
speech.speak("3")
if (num == 4):
speech.speak("4")
if (num == 5):
speech.speak("5")
if (num == 6):
speech.speak("6")
if (num == 7):
speech.speak("7")
if (num == 8):
speech.speak("8")
if (num == 9):
speech.speak("9")
if (num == 10):
speech.speak("10")
if (num == 11):
speech.speak("11")
if (num == 12):
speech.speak("12")
#file : home/Markus/TeensyForearm.ino edit raw
// These constants won't change. They're used to give names
// to the pins used:
const int analogInPin1 = A0; // Analog input pin that the potentiometer is attached to
const int analogInPin2 = A1; // Analog input pin that the potentiometer is attached to
const int analogInPin3 = A2; // Analog input pin that the potentiometer is attached to
const int analogInPin4 = A3; // Analog input pin that the potentiometer is attached to
const int analogInPin5 = A4; // Analog input pin that the potentiometer is attached to
const int analogInPin6 = A5; // Analog input pin that the potentiometer is attached to
const int analogInPin7 = A6; // Analog input pin that the potentiometer is attached to
const int analogInPin8 = A7; // Analog input pin that the potentiometer is attached to
const int analogInPin9 = A8; // Analog input pin that the potentiometer is attached to
const int analogInPin10 = A9; // Analog input pin that the potentiometer is attached to
const int analogInPin11 = A10; // Analog input pin that the potentiometer is attached to
const int analogInPin12 = A11; // Analog input pin that the potentiometer is attached to
int startValue1 = 0; // value read from the pot
int startValue2 = 0; // value read from the pot
int startValue3 = 0; // value read from the pot
int startValue4 = 0; // value read from the pot
int startValue5 = 0; // value read from the pot
int startValue6 = 0; // value read from the pot
int startValue7 = 0; // value read from the pot
int startValue8 = 0; // value read from the pot
int startValue9 = 0; // value read from the pot
int startValue10 = 0; // value read from the pot
int startValue11 = 0; // value read from the pot
int startValue12 = 0; // value read from the pot
int sensorValue1 = 0; // value read from the pot
int sensorValue2 = 0; // value read from the pot
int sensorValue3 = 0; // value read from the pot
int sensorValue4 = 0; // value read from the pot
int sensorValue5 = 0; // value read from the pot
int sensorValue6 = 0; // value read from the pot
int sensorValue7 = 0; // value read from the pot
int sensorValue8 = 0; // value read from the pot
int sensorValue9 = 0; // value read from the pot
int sensorValue10 = 0; // value read from the pot
int sensorValue11 = 0; // value read from the pot
int sensorValue12 = 0; // value read from the pot
void setup() {
// initialize serial communications at 57600 bps:
Serial.begin(57600);
delay(1000);
startValue1 = analogRead(analogInPin1);
startValue2 = analogRead(analogInPin2);
startValue3 = analogRead(analogInPin3);
startValue4 = analogRead(analogInPin4);
startValue5 = analogRead(analogInPin5);
startValue6 = analogRead(analogInPin6);
startValue7 = analogRead(analogInPin7);
startValue8 = analogRead(analogInPin8);
startValue9 = analogRead(analogInPin9);
startValue10 = analogRead(analogInPin10);
startValue11 = analogRead(analogInPin11);
startValue12 = analogRead(analogInPin12);
delay(1000);
}
void loop() {
startValue1 = ((startValue1 * 19) + analogRead(analogInPin1)) / 20;
startValue2 = ((startValue2 * 19) + analogRead(analogInPin2)) / 20;
startValue3 = ((startValue3 * 19) + analogRead(analogInPin3)) / 20;
startValue4 = ((startValue4 * 19) + analogRead(analogInPin4)) / 20;
startValue5 = ((startValue5 * 19) + analogRead(analogInPin5)) / 20;
startValue6 = ((startValue6 * 19) + analogRead(analogInPin6)) / 20;
startValue7 = ((startValue7 * 19) + analogRead(analogInPin7)) / 20;
startValue8 = ((startValue8 * 19) + analogRead(analogInPin8)) / 20;
startValue9 = ((startValue9 * 19) + analogRead(analogInPin9)) / 20;
startValue10 = ((startValue10 * 19) + analogRead(analogInPin10)) / 20;
startValue11 = ((startValue11 * 19) + analogRead(analogInPin11)) / 20;
startValue12 = ((startValue12 * 19) + analogRead(analogInPin12)) / 20;
// read the analog in value:
sensorValue1 = analogRead(analogInPin1);
sensorValue2 = analogRead(analogInPin2);
sensorValue3 = analogRead(analogInPin3);
sensorValue4 = analogRead(analogInPin4);
sensorValue5 = analogRead(analogInPin5);
sensorValue6 = analogRead(analogInPin6);
sensorValue7 = analogRead(analogInPin7);
sensorValue8 = analogRead(analogInPin8);
sensorValue9 = analogRead(analogInPin9);
sensorValue10 = analogRead(analogInPin10);
sensorValue11 = analogRead(analogInPin11);
sensorValue12 = analogRead(analogInPin12);
if (sensorValue1 <= startValue1 - 50){
Serial.write(1);
delay(200);
}
if (sensorValue2 <= startValue2 - 50){
Serial.write(2);
delay(200);
}
if (sensorValue3 <= startValue3 - 50){
Serial.write(3);
delay(200);
}
if (sensorValue4 <= startValue4 - 100){
Serial.write(4);
delay(200);
}
if (sensorValue5 <= startValue5 - 100){
Serial.write(5);
delay(200);
}
if (sensorValue6 <= startValue6 - 50){
Serial.write(6);
delay(200);
}
if (sensorValue7 <= startValue7 - 50){
Serial.write(7);
delay(200);
}
if (sensorValue8 <= startValue8 - 50){
Serial.write(8);
delay(200);
}
if (sensorValue9 <= startValue9 - 50){
Serial.write(9);
delay(200);
}
if (sensorValue10 <= startValue10 - 50){
Serial.write(10);
delay(200);
}
if (sensorValue11 <= startValue11 - 50){
Serial.write(11);
delay(200);
}
if (sensorValue12 <= startValue12 - 50){
Serial.write(12);
delay(200);
}
// Serial.println(sensorValue5);
// Serial.println(startValue5);
delay(20);
}
GAH !!! version 119 !
GAH !!! version 119 ! You're killing me Markus ! :)
We don't even use the same low level library to interface the serial port (RXTXLib) ..
We (and Arduino IDE) have switched to JSCC !
Ok! Sorry! I guess I have to
Ok!
Sorry!
I guess I have to be better on keeping up with you guys.
We have new stuff !!! Come
We have new stuff !!! Come join us !
If anything does not work - tell us and we will fix it superfast !
Ok
Ok