Show Posts
Pages: 1 2 [3]
31  Using Arduino / Networking, Protocols, and Devices / Re: Connecting Two Microcontrollers Via Serial RS232 on: December 27, 2012, 01:07:10 am
Code:

/*
This software was made to demonstrate how to quickly get your Atlas Scientific product running on the Arduino platform.
An Arduino MEGA 2560 board was used to test this code.
This code was written in the Arudino 1.0 IDE
Modify the code to fit your system.
**Type in a command in the serial monitor and the Atlas Scientific product will respond.**
**The data from the Atlas Scientific product will come out on the serial monitor.**
Code efficacy was NOT considered, this is a demo only.
The TX3 line goes to the RX pin of your product.
The RX3 line goes to the TX pin of your product.
Make sure you also connect to power and GND pins to power and a common ground.
Open TOOLS > serial monitor, set the serial monitor to the correct serial port and set the baud rate to 38400.
Remember, select carriage return from the drop down menu next to the baud rate selection; not "both NL & CR".
*/



String inputstring = "";                                                       //a string to hold incoming data from the PC
String sensorstring = "";                                                      //a string to hold the data from the Atlas Scientific product
boolean input_stringcomplete = false;                                          //have we received all the data from the PC
boolean sensor_stringcomplete = false;                                         //have we received all the data from the Atlas Scientific product


  void setup(){                                                                //set up the hardware
     Serial.begin(38400);                                                      //set baud rate for the hardware serial port_0 to 38400
     Serial3.begin(38400);                                                     //set baud rate for software serial port_3 to 38400
     inputstring.reserve(5);                                                   //set aside some bytes for receiving data from the PC
     sensorstring.reserve(30);                                                 //set aside some bytes for receiving data from Atlas Scientific product
     }
 
 
 
   void serialEvent() {                                                         //if the hardware serial port_0 receives a char             
               char inchar = (char)Serial.read();                               //get the char we just received
               inputstring += inchar;                                           //add it to the inputString
               if(inchar == '\r') {input_stringcomplete = true;}                //if the incoming character is a <CR>, set the flag
              } 


  void serialEvent3(){                                                         //if the hardware serial port_3 receives a char
              char inchar = (char)Serial3.read();                              //get the char we just received
              sensorstring += inchar;                                          //add it to the inputString
              if(inchar == '\r') {sensor_stringcomplete = true;}               //if the incoming character is a <CR>, set the flag
             }



 void loop(){                                                                   //here we go....
     
  if (input_stringcomplete){                                                   //if a string from the PC has been recived in its entierty
      Serial3.print(inputstring);                                              //send that string to the Atlas Scientific product
      inputstring = "";                                                        //clear the string:
      input_stringcomplete = false;                                            //reset the flage used to tell if we have recived a completed string from the PC
      }

 if (sensor_stringcomplete){                                                   //if a string from the Atlas Scientific product has been recived in its entierty
      Serial.println(sensorstring);                                            //send that string to to the PC's serial monitor
      sensorstring = "";                                                       //clear the string:
      sensor_stringcomplete = false;                                           //reset the flage used to tell if we have recived a completed string from the Atlas Scientific product
      }
 }


32  Using Arduino / Networking, Protocols, and Devices / Connecting Two Microcontrollers Via Serial RS232 on: December 27, 2012, 12:43:46 am
What are the key factors I need to consider when connecting my Mega to a Mcu sending a stream in RS232 format?

This code is not streaming text in my serial window when I run it so I'm trying to figure out what the problem might be.

http://atlas-scientific.com/_files/code/Arduino-sample-code-EZ-COM.pdf

Here is my unit:
http://atlas-scientific.com/product_pages/embedded/flo-30.html

Thanks for any help.
33  Using Arduino / Programming Questions / Re: Error Messages in Arduino IDE on: September 11, 2012, 11:58:11 pm
OK, I think I got it working. I had to copy the custom library into

Quote
/usr/share/arduino/libraries

using a root level account.

Arduino in Ubuntu expects to see the folder (in this example Time) then the files inside the folder. I tried to make a sub directory but it did not detect the libraries and gave a bunch of compile errors.

Thanks for all the help!
34  Using Arduino / Programming Questions / Re: Error Messages in Arduino IDE on: September 10, 2012, 09:36:25 pm
I don't understand why you have the WString files in tabs. Are they in your sketch folder?

I thought it needed that library.
35  Using Arduino / Programming Questions / Re: Error Messages in Arduino IDE on: September 10, 2012, 09:34:00 pm
The Time library is installed in the wrong place.

What version of the IDE are you using?

That sketch does not reference the String class, so it's hard to see what your problem is. With the Time library in the correct place, using 1.0, and with the include statement fixed, I get only this "error" message:
Quote
Binary sketch size: 9220 bytes (of a 258048 byte maximum)

I'm using 0022ubuntu0.1.

I'm confused on where I'm supposed to save my sketchbooks and where Arduino looks for them.

I've attached a few screenshots for reference.
36  Using Arduino / Programming Questions / Re: Error Messages in Arduino IDE on: September 08, 2012, 03:12:50 pm
I just added the *.pde file
37  Using Arduino / Programming Questions / Re: Error Messages in Arduino IDE on: September 08, 2012, 12:46:21 pm
Rough date.

I erased my linux user login. I'll post the code later when I get back to my workstation.
38  Using Arduino / Programming Questions / Error Messages in Arduino IDE [SOLVED] on: September 08, 2012, 11:32:19 am
I am very green to creating a compiling environment so please bare with me.

I'm trying to compile the time/clock example but I get these error messages. Any suggestions on what I should be doing?

Quote
WString.cpp:30:1: error: prototype for ‘String::String(int)’ does not match any in class ‘String’
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:39:5: error: candidates are: String::String(long unsigned int, int)
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:38:5: error:                 String::String(long int, int)
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:37:5: error:                 String::String(unsigned int, int)
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:36:5: error:                 String::String(int, int)
/usr/share/arduino/hardware/arduino/cores/arduino/WString.h:35:5: error:                 String::String(unsigned char)
Pages: 1 2 [3]