Show Posts
|
|
Pages: [1] 2
|
|
2
|
Using Arduino / Programming Questions / Can I set pins 27, 28 to digital INPUT OUTPUT ?
|
on: April 06, 2013, 10:22:56 pm
|
Having troubles settings 27, 28 to digital INPUT OUTPUT. I want to attach ultrasound sensor, but it just doesnt work. int dypOutputPin = 28; // TRIG int dypInputPin = 27; // ECHO
....
void setup() { pinMode(dypOutputPin, OUTPUT); pinMode(dypInputPin, INPUT); }
void loop() {
//scan forward USS (ultrasonic sensor) digitalWrite(dypOutputPin, LOW); delayMicroseconds(2); digitalWrite(dypOutputPin, HIGH); delayMicroseconds(10); digitalWrite(dypOutputPin, LOW); // the distance is proportional to the time interval // between HIGH and LOW distance = pulseIn(dypInputPin, HIGH,50); cm = distance/58; Serial.println(cm); delay(50); }
Arduino UNO R3
|
|
|
|
|
3
|
Topics / Robotics / Re: Dagu Rover 5 chassis robot demo
|
on: February 27, 2013, 08:06:08 pm
|
|
Thank Nick you for the sample sketch!
I've manage to put together a small rover based on same motor control board and Leonardo. Only one difference I have 4WD, so I will modify it in order to handle all 4 wheels, if you don't mind.
I solve my problem with JST by just wrapping bare wire around prongs, no pretty by will work for now.
|
|
|
|
|
5
|
Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1
|
on: February 25, 2013, 10:27:36 pm
|
|
Finally!!! I got it, apparently Prolific modules doesn't work properly with Leonardo, the very first one on the picture is Prolific as well, not FTDI. So luckily I had one actual FTDI attached to my MultiWii controller, when I've used that one - now all works!
They actually partially working , writing data from Arduino to PC was fine! But not reading! Crazy... I have no idea why it was so messy with Prolific chip based Ser/USB breakout boards, any ideas?
|
|
|
|
|
8
|
Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1
|
on: February 25, 2013, 07:58:56 pm
|
Tried, still doesn't work here is my sketch: int incomingByte = 0;
void setup(){ Serial1.begin(57600); Serial.begin(57600); while (!Serial1) { } }
void loop() { //Serial1.println(100,DEC); // send data only when you receive data: while (Serial1.available()) { Serial.print("Available"); if (Serial1.available() > 0) { // read the incoming byte: incomingByte = Serial1.read(); // say what you got: Serial.print("I received: "); Serial.println(incomingByte, DEC); } } }
|
|
|
|
|
9
|
Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1
|
on: February 25, 2013, 07:40:08 pm
|
Sure, here is my current sketch: int incomingByte = 0;
void setup(){ Serial1.begin(57600); Serial.begin(57600); }
void loop() { //Serial1.println(100,DEC); // send data only when you receive data: while (Serial1.available()) { Serial.print("Available"); if (Serial1.available() > 0) { // read the incoming byte: incomingByte = Serial1.read(); // say what you got: Serial.print("I received: "); Serial.println(incomingByte, DEC); } } } Swapping RX-TX on Leonardo (0<->1) doesn't help But when I detach RX-TX and send characters over to COM9 (FTDI) I see it blinks, if I attach them to Leonardo, and reboot, nothing blinks when I send characters.
|
|
|
|
|
11
|
Using Arduino / Programming Questions / Re: Arduino Leonardo troubles reading from Serial1
|
on: February 25, 2013, 06:19:00 pm
|
|
I use Putty, settings are 57600, 8, 1, N Local echo turned on. FTDI has 5 pins: 3.3V GND RX TX 5V
FTDI RX goes to PIN1 (TX) FTDI TX goes to PIN0 (RX)
Can someone post me an example where I can read data from Serial1 and print it in Serial, Read data from Serial and print it in Serial1 ? This essentially what I need, just need to run some logic in between....
|
|
|
|
|
13
|
Using Arduino / Programming Questions / Arduino Leonardo troubles reading from Serial1
|
on: February 25, 2013, 02:29:43 am
|
I having troubles with Arduino Leonardo when reading from Serial1 Here is my super simple code: int incomingByte = 0;
void setup(){ Serial1.begin(57600); }
void loop() { // send data only when you receive data: while (Serial1.available()) { Serial.print("Available"); if (Serial1.available() > 0) { // read the incoming byte: incomingByte = Serial1.read(); // say what you got: Serial.print("I received: "); Serial.println(incomingByte, DEC); } } }
When I write from PC I dont see any activity on FTDI LEDs (green, yellow) Interesting thing is: when I skip Serial1.begin(57600); I see blinking light (yellow) on FTDI board conected to PIN 0/1, when I send data from PC But when I run: int incomingByte = 0;
void setup(){ Serial1.begin(57600); }
void loop() { Serial1.println(100,DEC); // send data only when you receive data: while (Serial1.available()) { Serial.print("Available"); if (Serial1.available() > 0) { // read the incoming byte: incomingByte = Serial1.read(); // say what you got: Serial.print("I received: "); Serial.println(incomingByte, DEC); } } }
I see green light on FTDI working all the time, and when I write on other side (PC) yellow LED on FTDI blinks, but I receive some messy data, even if I write same thing all the time.... Please advise. I just want to read and write completely independently.
|
|
|
|
|