Show Posts
Pages: 1 [2] 3 4 ... 136
16  Using Arduino / Programming Questions / Re: smiple "calcuation" problem? on: March 02, 2011, 09:36:20 pm
nr1 = nr2 + 1;
EDIT: I mixed them up, see the post below... Embarrassing!
17  Using Arduino / Programming Questions / Re: Arduino to arduino serial communication on: March 02, 2011, 09:33:24 pm
You're probably sending the numbers as ASCII strings, and not as byte values.

Try to send using the BYTE modifier.


To verify communication change the slave loop to
Code:
void loop() {
  x = Serial.read();
  if (x!=-1) { digitalWrite(13,HIGH); delay(1000); digitalWrite(13,LOW); }
}
18  Using Arduino / Programming Questions / Re: Is There a Way to Save Variables? on: March 02, 2011, 04:40:47 pm
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1281456125#2

Might do what you want, or check out the EEPROM library (that the above library uses).
19  Using Arduino / Programming Questions / Re: Arduino to arduino serial communication on: March 02, 2011, 04:37:26 pm
Sounds right, did you try it?
20  Using Arduino / Programming Questions / Re: loop speed control on: February 28, 2011, 04:45:19 pm
PSEUDOCODE
Code:
void loop() {
  //take note of time before
  //do your thing
  //timeSpent = currentTime - before
  //if timeSpent is not enough , simply wait before returning
  //  delay(timeToSpend-timeSpent); //if you need 50 times a second you'll need timeToSpend = 1000 / 50;
}
21  Using Arduino / Programming Questions / Re: Read big array from header file on: February 28, 2011, 04:11:34 pm
The Uno has 2k of RAM, I think you'll need to use PROGMEM for this array then. smiley
22  Using Arduino / Programming Questions / Re: Read big array from header file on: February 28, 2011, 03:24:39 pm
10k !

What kind of an Arduino monstrosity are you using?
23  Using Arduino / Programming Questions / Re: Student needs help! on: February 28, 2011, 01:03:33 pm
Where is the return type?

Now, this was fun  smiley-wink
24  Using Arduino / Programming Questions / Re: Student needs help! on: February 28, 2011, 09:28:18 am
I do not think you need multitasking for this to operate as expected.

This might get you somewhere:
Code:
/*
An alarm should sound if the temperature of a piece of equipment rises above 60 oC.
A light should be controlled that comes on when it is dark.

Use a piezo buzzer for the alarm, and a white LED for the light.
Use a thermistor and 4.7kO resistor to sense the temperature.
Use an LDR and 4.7kO resistor to sense the light.
Use two “trimmer type” potentiometers to set the levels of voltage at which lights and alarms go on.
You will thus use four ADC channels.
*/

//variables for the pin
const byte ledPin = 13;
const byte piezoPin = 11;
///TODO continue adding your variables

void setup() {
pinMode(ledPin,OUTPUT);
pinMode(piezoPin,OUTPUT);
}

void loop() {
  checkTemperature();
  checkIfLightShouldTurnOn();
  delay(500);
}

///TODO implement comments
void checkTemperature() {
  //read the threshold value from the temperature threshold trimpot
  //read the value from the thermistor
  //check the value against the value from the thermistor
  //if (thermistorValue > threshold) {
    tone(piezoPin,440,1000);
  //}
}

///TODO implement comments
void checkIfLightShouldTurnOn() {
  //read the threshold value from the light threshold trimpot
  //read the value from the LDR
  //check the value against the value from the LDR
  //if (ldrValue < threshold) {
    digitalWrite(ledPin,HIGH);
  //} else {
    digitalWrite(ledPin,LOW);
  //}
}

That code will block the processing of light conditions while sounding the alarm, and it will check two times a second (1000/500 = 2) maximum because of the delay() in the loop.

Happy coding!
25  Using Arduino / Programming Questions / Re: Object Pass by reference on: February 27, 2011, 09:29:58 pm
It's a problem with the IDE, try to author your class and your transition function in a different tab smiley
26  Using Arduino / Programming Questions / Re: Button Library question. on: February 27, 2011, 07:54:48 pm
Please do post the code smiley
I cannot reproduce the errors here.
27  Using Arduino / Programming Questions / Re: MOTOR NSS CODING HELP !!!!!!!!!!!!! on: February 20, 2011, 09:24:56 am
Did you choose the right number in the begin() ?
28  Using Arduino / Programming Questions / Re: MOTOR NSS CODING HELP !!!!!!!!!!!!! on: February 19, 2011, 08:19:08 pm
Did you try write with nothing but the value?
29  Using Arduino / Programming Questions / Re: MOTOR NSS CODING HELP !!!!!!!!!!!!! on: February 19, 2011, 08:02:20 pm
I don't think write is applicable for the second parameter. Either try to simply remove BYTE or change write to print.
30  Using Arduino / Programming Questions / Re: MOTOR NSS CODING HELP !!!!!!!!!!!!! on: February 18, 2011, 12:22:49 pm
((BYTE)x);
Pages: 1 [2] 3 4 ... 136