Show Posts
Pages: 1 ... 796 797 [798] 799 800 ... 1117
11956  Forum 2005-2010 (read only) / Syntax & Programs / Re: Sending large values using Wire.send() on: June 15, 2009, 10:41:54 pm
Is "long long" type really avalible in the Arduino system? It's not listed in the Arduino reference data types.

Lefty

11957  Forum 2005-2010 (read only) / Syntax & Programs / Re: will attachInterrupt interfere with 74hc595 on: June 18, 2009, 06:32:20 pm
Using a attached interrrupt can effect the timing some on anything you have that is using delay(), etc,  as all interrupts are disabled upon entering your interrupt routine. This would result is some 'slowing' of timing loops. A lot depends on how much code you include in your ISR routine. The basic idea is to do as little as possible inside the ISR so that normal interrupts can be reenabled when your ISR completes. If you keep your ISR routines very terse then you may not even notice an effect.

Lefty
11958  Forum 2005-2010 (read only) / Syntax & Programs / Re: Trouble with if and HEX on: June 06, 2009, 11:20:34 pm
Try changing:

if (serBuff[serPoint] < 0x10, HEX)

to:

if (serBuff[serPoint] < 0x10)

The use of leading 0x.. tells the compiler that it is a hex value.

http://arduino.cc/en/Reference/IntegerConstants

Lefty
11959  Forum 2005-2010 (read only) / Syntax & Programs / Re: Digital input acting strange on: June 04, 2009, 08:12:10 pm
You need to either have external pull-up or pull-down resistor on the pin or activate the internal software pull-up resistor. A 'floating digital input pin is just reading noise and will not give a reliable default reading.

Add the following to your setup portion in your sketch.

pinMode(digitalSensor, INPUT);           // set pin to input
digitalWrite(digitalSensor, HIGH);       // turn on pullup resistors



http://arduino.cc/en/Tutorial/DigitalPins

Lefty
11960  Forum 2005-2010 (read only) / Syntax & Programs / Re: creating sensor-controlled coaster on: June 04, 2009, 05:46:51 pm
Quote
Absurdly simple, but I appreciate you taking the time to walk me through it.

Your welcome, and simple is about all I can deliver when it comes to software advice/solutions  smiley-wink

Lefty


11961  Forum 2005-2010 (read only) / Syntax & Programs / Re: creating sensor-controlled coaster on: June 04, 2009, 03:04:25 pm
When I stated my suggestion was in 'pseudo code' that meant it was not official C code statements, but rather just English logic steps to be taken. You seem to be missing the setup portion but I assume it's in your real sketch. Try these changes:

Code:
void loop() {

 forceValue1 = analogRead(forcePin1);
 forceValue2 = analogRead(forcePin2);
 totalForceValue = (forceValue1+forceValue2)/2;
 totalForceValue = constrain(totalForceValue,0,550);
 Serial.println(totalForceValue);

 thermValue = analogRead(thermPin);
 thermValue = constrain(thermValue,90,140);

if(totalForceValue > 75)
{
 Serial.println(thermValue);
}
  
 //new, piping hot cup of coffee
 if(totalForceValue == 500 && thermValue == 140)
 {
   digitalWrite(led1,HIGH);
   digitalWrite(led2,HIGH);
   digitalWrite(led3,HIGH);
 }
 
 if(totalForceValue >= 400 && thermvValue >= 130 && thermValue < 140)
 {
   digitalWrite(led2,HIGH);
   digitalWrite(led3,HIGH);
 }
 
if(totalForceValue >= 400 & thermValue >= 116 && thermValue < 130)
 {
   digitalWrite(led3,HIGH);
 }


11962  Forum 2005-2010 (read only) / Syntax & Programs / Re: creating sensor-controlled coaster on: June 04, 2009, 01:57:52 am
Well it seems pretty straight forward. In pseudo code:

Loop:

read pressure_value
display pressure_value
read temp_value
if pressure_value > 75 then display temp_value

back to Loop

That make sense?

Lefty
11963  Forum 2005-2010 (read only) / Syntax & Programs / Re: creating sensor-controlled coaster on: June 04, 2009, 01:14:10 am
What do you mean by "the program will pause the thermistor readings" ?

Hold temp display at last valid reading?
Blank the temp display?

Lefty
11964  Forum 2005-2010 (read only) / Syntax & Programs / Re: newbie : interrupt in arduino (not AVR-C) on: June 03, 2009, 08:35:42 pm
I think the problem is your using a delay function inside the ISR function, when I tried that once it locked up my sketch. Generally you want to do as little as possible inside a ISR function, such as set a global flag variable and test that in your main loop function to determine to take action because of the interrupt and then reset the flag and wait until the ISR sets the flag on the next received interrupt.


The following is from the reference section:

Quote
Note
Inside the attached function, delay() won't work and the value returned by millis() will not increment. Serial data received while in the function may be lost. You should declare as volatile any variables that you modify within the attached function.

Obtained here:  http://arduino.cc/en/Reference/AttachInterrupt

Lefty


11965  Forum 2005-2010 (read only) / Syntax & Programs / Re: fast bidirectional data bus on: June 01, 2009, 12:54:44 pm
You can read or write directly to ports using the Arduino IDE. You just have to determine the port names for your 644 processor chip.

http://www.arduino.cc/en/Reference/PortManipulation

Lefty
11966  Forum 2005-2010 (read only) / Syntax & Programs / Re: fast bidirectional data bus on: June 01, 2009, 12:36:05 pm
That is where the new Mega board could really shine with it's additional I/O ports and by using direct port access code (instead of single bit digital reads and writes) you should have no trouble supplying or receiving parallel data at high speeds. Use interrupt pins and routines for the handshaking control bits and you would have speed to spare for most any application.

Lefty

11967  Forum 2005-2010 (read only) / Syntax & Programs / Re: New to Arduino, Need Help Coding on: May 30, 2009, 10:43:34 pm
Quote
but if I hook up the Arduino like in my picture will it still work? With the two things hooked up to the negative.

Yes that hook-up will work.  However there are three ground pins avalible on the Arduino pin connectors, look them over. Also make sure your buzzer doesn't require more then 40ma of current when on.

Lefty

11968  Forum 2005-2010 (read only) / Syntax & Programs / Re: Differentiate between A3 and D3 in code on: May 28, 2009, 02:25:15 pm
http://arduino.cc/en/Reference/DigitalRead
11969  Forum 2005-2010 (read only) / Syntax & Programs / Re: Differentiate between A3 and D3 in code on: May 28, 2009, 01:42:53 pm
Then you use the following from the Arduion reference section:

"The analog input pins can be used as digital pins w/ numbers 14 (analog input 0) to 19 (analog input 5). "

so using:

pinMode(17, INPUT);
val = digitalRead(17);

Will allow the A3 pin to be used as a digital input pin.

Lefty
11970  Forum 2005-2010 (read only) / Syntax & Programs / Re: Differentiate between A3 and D3 in code on: May 28, 2009, 01:34:35 pm
Quote
I can do analogRead(3) and that's A3 right?  Can't I also do digitalRead(3) and that be D3?

Yes, that is correct the analogread and digitalread functions know which pin 3 to use, A3 or D3 respectively.

Lefty

Pages: 1 ... 796 797 [798] 799 800 ... 1117