Go Down

Topic: flash interfacing on os x (Read 1 time) previous topic - next topic


May 18, 2006, 06:08 am Last Edit: May 18, 2006, 06:12 am by prisonerjohn Reason: 1
i just got my arduino board today (very cool, by the way) and i'm trying to interface with flash but i am having a little problem.

i make the connection and it works and flash and arduino seem to be communicating but this is the output i get:
- Flash: Hi Arduino, can you hear me?





what's up with that arduino response? that's not normal, is it? i also get the same kind of thing when i use the monitor with the serial_comm examples.

here's my system info:
- arduino 04 on os x
- usb board
- using port /dev/cu.usbserial-1B1

thanks for the help!


It may be a mismatch between the baud rate the Arduino board is using to communicate over the USB/serial port and the baud rate the software on the Mac is using.

What are you using to forward data between Flash and the board?  serproxy?  What code is running on the Arduino board?


May 18, 2006, 02:57 pm Last Edit: May 18, 2006, 02:58 pm by prisonerjohn Reason: 1
the code running on the board is from the flash example that you posted in this forum.  according to it, i'm using a baud rate of 9600.  do i have to change this value?  

i am using serproxy, by the way

here is the code (stripped from comments):
Code: [Select]

/* ------------------------------------------------
* by beltran berrocal, b@progetto25zero1.com
* created 30 Decembre 2005;
* copyleft 2005 Progetto25zero1  <http://www.progetto25zero1.com>
* --------------------------------------------------- */

char serInString[100];
int sentenceNum = 0;  

void readSerialString (char *strArray) {
   int i = 0;
   if(serialAvailable()) {    
      while (serialAvailable()){            
         strArray[i] = serialRead();

void printSerialString(char *strArray) {
    int i=0;
    if (strArray[i] != 0) {    
        while(strArray[i] != 0) {
           serialWrite( strArray[i] );
           strArray[i] = 0;                  // optional: flush the content

boolean isStringEmpty(char *strArray) {
    if (strArray[0] == 0) {
        return true;
    } else {
        return false;

void sendStringToFlash (unsigned char *s) {
     while (*s) {
       printByte(0); //notify the XMLSocket that the comunication is over

void ArduinoConversation(int i) {
 if(i==0)        {sendStringToFlash("Arduino: Mamma mia Flash, Yes I can hear yu!");
 } else if(i==1) {sendStringToFlash("Arduino: well, let's go have a BIRRA together, wat do yu tink?");
 } else if(i==2) {sendStringToFlash("Arduino: don't worry! it'll just make my pins go analog analog ;-)");
 } else if(i==3) {sendStringToFlash("Arduino: glu glu glu! your turn now dude, insted of just lurking... ask me something!");
 } else if(i>=4)  {
     printString("Arduino: unfortunately for you my master is smart as one of my digital pins ;-) ,");
     printString(" which means that I don't have an answer for that yet!");
     printString(" I'll ask babbo 'touring' natale to give me a neural network for handeling natural speaking next time");
     printByte(0); //end of communications in XMLSocket

void setup() {
 beginSerial(9600);  //setup serial conversation at 9600 bauds

void loop () {
 if( isStringEmpty(serInString) == false) {
     printString("Arduino heard you saying: ");
     ArduinoConversation( sentenceNum );


I think the serproxy defaults to 19200 baud, so you'll need to change one of them.  Either edit the beginSerial line in the Arduino code or the comm_baud parameter in the serproxy.cfg file.


May 18, 2006, 08:58 pm Last Edit: May 18, 2006, 08:59 pm by beltran Reason: 1
yes that might be it!
the serial proxy configuration defaults to 9600 bauds (at least the version I've got locally)

# Default settings

either edit this or the beginSerial value in the Arduino code

another thing that sometimes happens is that EVEN if the bothe speed are the same
somenthing goes wrong in the exchange and the two processors start talking nonsense to each other

a very simple solution to this problem is to reset the arduino board (through its reset button)
while the serial connection is still open...everything will work perfectly



sounds good
i'll give it a try when i get home from work and post the outcome


the baud rate was the problem, i changed it to 19200 and it works great
thanks for the help!

also, I forgot to mention this, but I get the following error when I compile the Arduino source:
In function 'void ArduinoConversation(int)':
error: invalid conversion from 'const char*' to 'unsigned char*

i just took out "unsigned" from the sendStringToFlash() function and it compiles properly.
beltran, you may want to look into that...


thanks for pointing it out...
are you compiling it with arduino4?
the fact is that I've never tryed it yet with arduino4...and heard other people around are having this kind of problems: code written for previous versions of arduino seem to be buggy in arduino4...

this is a question for mellis: is it a backwards compatibility problem or is it that previous versions of arduino led us all to bad coding conventions?



>>are you compiling it with arduino4?

yes i am


thanks for pointing it out...
this is a question for mellis: is it a backwards compatibility problem or is it that previous versions of arduino led us all to bad coding conventions?

A little of both.  Arduino 0004 compiles sketches as C++ (whereas Arduino 0003 used C) which allows use to use the nice, Processing-like syntax for serial communication and other library.  C++, however, is stricter about some things, like types and function prototypes.  In general, though, it should be relatively easy to get things working.  As usual, I'll try to help people who post in the forums, and summarize the main issues in the FAQ.


does that mean that if in arduino3 you could write any C code in the sketch
now in arduino4 you should could write code in C++???

if that is the case do you have any good online reference or resource to maybe post on the playground wiki so that people can learn c++ and the differences between it and simple C?

any ideas?
thanks in advance

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

shortcuts: alt+s submit/post or alt+p preview