Show Posts
Pages: 1 [2] 3 4 ... 6
16  Using Arduino / Interfacing w/ Software on the Computer / Re: arduino and pc on: October 21, 2013, 09:07:23 am
can i use arduino to start the pc and run processing sketch file after that???
Sure, you only need to short the two power wires to start the computer up, and then just put a processing sketch thats been exported (or a shortcut to said program) in the the startup folder and it will auto run.

P.S I don't recommend messing around with your computer unless you know what you are doing..
17  Using Arduino / Programming Questions / Re: Creating columns in a CSV file? on: October 14, 2013, 08:47:53 pm
Thanks for the reply Pete.

I tried that above but it wrote it first instead. See code above.
Full code please
18  Using Arduino / Programming Questions / Re: [SOLVED] Trouble passing integer values from Uno to Mega using rx-tx on: September 02, 2013, 11:04:36 pm
That sounds great. I was going to make something like this awhile back but never got around to it. anyway once you finish you should look into post a guide with the code a schematics and http://www.instructables.com/ so other can make it.

Good luck!!  smiley-wink
19  Using Arduino / Programming Questions / Re: Trouble passing integer values from Uno to Mega using rx-tx on: September 02, 2013, 09:15:39 pm
OMG it works!!!!!!!! Nice! You guys are great to have available to answer questions. Can't thank you enough, I may even sleep tonight.

Hope after I get a lot more under my belt I can return the favor to others. Thank you so much!
smiley smiley smiley
Great to know!! Can you post your new code? Also if you can add [SOLVED] to the title so if anyone is looking for help they can try here.
20  Using Arduino / Programming Questions / Re: Trouble passing integer values from Uno to Mega using rx-tx on: September 02, 2013, 08:55:14 pm
Oops this one was my fault
Code:
 if(dataRefreshed = true){}

Code:
 if(dataRefreshed){}
  if(dataRefreshed == true){}
Both may work, but the latter is easier to read at a glance.


The code i posted will not print anything until it has been sent the "endOfNumberDelimiter"
So in "processInput" you will need to change "dataRefreshed" to true, if you are sent the "endOfNumberDelimiter".

You need to have this inside the same if statment that you are printing in, not outside of it.
Code:
dataRefreshed = false;
E.g
Code:
if(dataRefreshed == true){
  Serial.print("I'M TALKING HERE!!");
  dataRefreshed = false;
21  Using Arduino / Programming Questions / Re: Extracting Data from SoftwareSerial on: September 02, 2013, 07:57:40 pm
It would be easier to help if you could supply some example input..
22  Using Arduino / Programming Questions / Re: Trouble passing integer values from Uno to Mega using rx-tx on: September 02, 2013, 07:48:20 pm
If you add this code, it should only print once the data has been refreshed.
Code:
{
bool dataRefreshed = flase; //Declare as global variable
void loop(){
  if (Serial1.available ()) {
    processInput ();
  }

  if(dataRefreshed == true){
    //Print outputs here
    dataRefreshed = false;
  }
}
You will need to set dataRefreshed to TRUE when you find the end delimiter
23  Using Arduino / Programming Questions / Re: Serial.Read on: August 08, 2013, 03:52:20 am
you can not compare strings the way you have.. You must use .equals()
E.g
Code:
String myString = "Hello";
String thisString = "World";

if(myString.equals(thisString)){ // this is the same as myString == thisString
    //it works
}
if(myString.equals("Add a String here")){ // this is the same as myString == "Add a String here"
    //it works
}

For more details check this reference page:
24  Using Arduino / Programming Questions / Re: Serial? on: August 04, 2013, 12:09:54 pm
I dunno who to quote, since you're all helping me out quite a bit so I'll just throw this out here... I don't really mind if it doesn't send the data as "MY" or "MN" or whatever. I assume if I send M from Python encoded as ASCII, serial.read would need to return a number? Also, edited the OP with code tags.

Tried tigerbomb's solution and it didn't seem to work. Pin 12 NEVER even goes high.
I tested it with the arduino IDE serial monitor and is seems to work fine
You need to import the time library and then call the following code before you try to send anything but after you have opened the port. This will give enough time for the Arduino to reset
Code:
import time

time.sleep(2)
here is an example
Code:
import time, serial, sys

SERIALPORT = "COM3"

ser = serial.Serial(SERIALPORT, 9600)
time.sleep(2)
ser.write('<')
ser.write('M')
ser.write('Y')
ser.write('>')

ser.close()
25  Using Arduino / Programming Questions / Re: Serial? on: August 04, 2013, 07:28:43 am
Try incorporating this into your code..
This will take chars from the buffer and add them to a string called serialInput
If you use this code you need to send your data surrounded by a '<' and '>'
e.g <MY> or <MN>
Code:
const char startOfDelimiter = '<';
const char endOfDelimiter = '>';
String serialInput;
boolean allowInput = false;

//----------------------------------------------//

void setup(){
  Serial.begin(9600);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(12, OUTPUT);
}

//----------------------------------------------//

void loop(){
if(Serial.available()){
digitalWrite(12, HIGH);
processInput();
}
if(serialInput.compareTo("MY") == 0){
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
}else if(serialInput.compareTo("MN") == 0){
digitalWrite(10, HIGH);
digitalWrite(9, LOW);
}
}

//----------------------------------------------//

void processInput(){
char inputedChar = Serial.read();
  switch(inputedChar){
   case startOfDelimiter: //Preps anything for an input
    serialInput = ""; //Clears "serialInput" ready for new input
    allowInput = true; //Allows characters to be added to "serialInput" in the default case
    break;

   case endOfDelimiter:
    allowInput = false;
    while(Serial.available()){ // Clears the buffer of any extra junk after the end delimiter
  Serial.read(); //
  } //
    break;

   default:
    if(allowInput == true){ // Add the inputed chars to the string if the starting delimiter has been sent
    serialInput = serialInput + inputedChar;
    }else{
    while(Serial.available()){ //Clears the buffer
  Serial.read();
  }
    }
    break;
   }
}

P.S I know this is going to keep adding chars to the string.. going to fix it and repost
Should Will work now!
P.P.S can an admin look into making tab stops equivalent to 2-4 spaces.
26  Using Arduino / Interfacing w/ Software on the Computer / Re: thermostat project on: July 27, 2013, 11:13:12 am
If you want to know what dead band is look at this http://en.wikipedia.org/wiki/Deadband
27  Using Arduino / Interfacing w/ Software on the Computer / Re: Arduino Duemilanove and uno serial connection without any problems ? on: July 23, 2013, 02:11:50 pm
Connect Rx to Tx, Tx to Rx, Gnd to Gnd.

yes but will it have any problems in the future i mean for 2 different arduinos ?
the only problem you might come across, is the lack of spare arduinos for other projects.
28  Using Arduino / Interfacing w/ Software on the Computer / Re: Ubuntu C++ <--> Mega2560 Serial Communication on: July 23, 2013, 01:07:56 pm
Quote
I couldn't find a working code in the web.
Unbelievable.

Quote
Does anybody know, how to solve my problem?
Google again. Perhaps with a less narrow search. C++ on Ubuntu, windoze, etc. is the same.
What's windoze? I have never heard of it.
29  Using Arduino / Microcontrollers / Re: What Are The Pros And Cons Of Not Using The Arduino Bootloader on: October 02, 2012, 01:19:44 am
thanks for the information guys/gals. it looks like i will stick with the bootloader.
i already have a shield for programing attinys so i can add a spot for the atmega328 and burn the bootloader my self. that will save me a couple of $$
30  Using Arduino / Microcontrollers / Re: What Are The Pros And Cons Of Not Using The Arduino Bootloader on: October 01, 2012, 02:56:16 am
well i already know how the use the UNO as an ISP. i just made a shield so i can program the attiny chips
Pages: 1 [2] 3 4 ... 6