|
2008-04-10
, 19:04
|
Posts: 155 |
Thanked: 69 times |
Joined on Apr 2008
|
#22
|
|
2008-04-11
, 14:00
|
|
Posts: 100 |
Thanked: 13 times |
Joined on Mar 2008
|
#23
|
|
2008-04-11
, 17:49
|
Posts: 6 |
Thanked: 4 times |
Joined on Nov 2007
|
#24
|
I think you have a very good point about baby steps, taking things slowly etc.
So, if one wished to hook up the tablet to the arduino and send the most basic serial info from the tablet to the arduino, where would on start? Does one need to do anything fancy to get the tablet to send serial info over the usb port?
It sound like maybe that was the inital subject of this thread. Does anyone know if any progress was made?
import serial import time import pygame from pygame.locals import * pygame.init() screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption('Pygame Caption') pygame.mouse.set_visible(0) done = False ser = serial.Serial('/dev/tty.usbserial-A4001u0a', 9600, timeout = 1) while not done: for event in pygame.event.get(): if (event.type == KEYUP) or (event.type == KEYDOWN): print event if (event.key == K_ESCAPE): done = True elif (event.key == K_UP): if (event.type == KEYUP): ser.write('1') else: ser.write('0') #print ser.readlines() elif (event.key == K_DOWN): if (event.type == KEYUP): ser.write('3') else: ser.write('2')
/*Messing around with pygame and motor controller */ #define pwmPin 9 #define dirPin 10 #define forwardDown 48 #define forwardUp 49 #define backDown 50 #define backUp 51 void setup() // run once, when the sketch starts { Serial.begin(9600); // opens serial port, sets data rate to 9600 bps pinMode(pwmPin, OUTPUT); // sets the digital pin as output pinMode(dirPin, OUTPUT); } void loop() // run over and over again { if (Serial.available() > 0) { // read the incoming byte: int incSerialByte = Serial.read(); // say what you got: Serial.print("I received: "); Serial.print(incSerialByte, DEC); if(incSerialByte == forwardDown) { analogWrite(pwmPin, 255); Serial.println(" forwardDown"); } else if(incSerialByte == forwardUp) { analogWrite(pwmPin, 0); Serial.println(" forwardUp"); } else if(incSerialByte == backDown) { digitalWrite(dirPin, HIGH); analogWrite(pwmPin, 255); Serial.println(" backDown"); } else if(incSerialByte == backUp) { digitalWrite(dirPin, LOW); analogWrite(pwmPin, 0); Serial.println(" backUp"); } } }
The Following 3 Users Say Thank You to D-rock For This Useful Post: | ||
|
2008-04-11
, 18:10
|
Posts: 155 |
Thanked: 69 times |
Joined on Apr 2008
|
#25
|
|
2008-04-19
, 20:23
|
|
Posts: 100 |
Thanked: 13 times |
Joined on Mar 2008
|
#26
|
/usr/bin/python_serial.py:4: RuntimeWarning: import cdrom: No module named cdrom import pygame /usr/bin/python_serial.py:4: RuntimeWarning: import joystick: No module named joystick import pygame Traceback (most recent call last): File "/usr/bin/python_serial.py", line 14, in <module> ser = serial.Serial('/dev/tty.usbserial-A4001u0a', 9600, timeout = 1) File "/usr/bin/serial/serialutil.py", line 156, in __init__ self.open() File "/usr/bin/serial/serialposix.py", line 141, in open raise SerialException("Could not open port: %s" % msg) serial.serialutil.SerialException: Could not open port: [Errno 2] No such file or directory: '/dev/tty.usbserial-A4001u0a' Press ENTER to continue ...
|
2008-04-20
, 07:34
|
Guest |
Posts: n/a |
Thanked: 0 times |
Joined on
|
#27
|
Honestly, I don't even know what this means. But I get the impression that it means that the code isn't running correctly.Code:ser = serial.Serial('/dev/tty.usbserial-A4001u0a', 9600, timeout = 1)
The Following User Says Thank You to For This Useful Post: | ||
|
2008-05-06
, 13:50
|
Posts: 20 |
Thanked: 1 time |
Joined on Apr 2008
|
#28
|
|
2008-05-06
, 18:38
|
Guest |
Posts: n/a |
Thanked: 0 times |
Joined on
|
#29
|
is it even possible to receive volt measurements over arduino-> NIT serial connection? I need the 4channel data at least at 5-10 frames per second.. sounds possible?
|
2008-05-06
, 20:43
|
|
Posts: 100 |
Thanked: 13 times |
Joined on Mar 2008
|
#30
|
I was able to talk to my arduino over serial from my 770 (See my post on page 1). You'll need a USB power injector because the 770 wasn't meant to be used as a USB host.
I'm not sure what the best way to send info to the arduino, other than it needing it to be serial. I wonder what app on the nokia would be simplest to send out some serial instructions through the nokia's bt. And I don't really know how the arduino bt works.
From what I understand, the arduino IDE (running on a terminal on some machine) can send and receive info from the arduino bt. But something tells me that this is not the best way to set up controlling the arduino. It seems like it would require constant reprogramming in the IDE, which in turn would require the time involved in recompiling and reuploading to the uC.
It seems like most of the folks out there that have gotten the nokia to talk to the arduino have done so using Python. I don't know anything about Python, but I am willing to learn.
Is there any reason that setting up the serial communication through bt couldn't work with the nokia-as-super-robot-brain idea? Obviously, one would loose some of the functionality described before, such as the nokia's camera and voice synthesis capabilities (or lose them as a useful feature on the robot).
However, if one could use the bt to communicate between the nokia and the arduino, and retain the nokia's role as the superlogic that interprets the info it gets from the arduino, that might be interesting.