Show Posts
Pages: 1 ... 5 6 [7]
91  Using Arduino / Programming Questions / Re: Cant stop code from being run after reset on: January 31, 2013, 07:22:24 pm
No, I meant Webca.

92  Using Arduino / Programming Questions / Re: LED brightness control on: January 31, 2013, 05:07:24 pm
You got it!
93  Using Arduino / Programming Questions / Re: Cant stop code from being run after reset on: January 31, 2013, 05:05:45 pm
Your new initialization code:

Code:
byte lastbuttonState = 0; // new global variable

initializes to the button being pressed in the new scheme, yes?

Please post your entire code...
94  Using Arduino / Programming Questions / Re: LED brightness control on: January 31, 2013, 04:12:13 pm
look here:

http://arduino.cc/en/Tutorial/InputPullupSerial
95  Using Arduino / Programming Questions / Re: Cant stop code from being run after reset on: January 31, 2013, 04:07:09 pm
Did you change the button logic in activate() as well?

Please re-pot your entire code.
96  Using Arduino / Programming Questions / Re: LED brightness control on: January 31, 2013, 03:49:34 pm
Here's my try:

Connect a SPST N.O. momentary from pin 8 to GND with no resistor.
Connect an LED from pin 9 to an LED in series with a current-limiting resistor (220 to 330 ohm) to GND.

My code:
Code:
int but = 8;
int led = 9;
int val = 0;

void setup()
{
  pinMode(but, INPUT_PULLUP);
  pinMode(led, OUTPUT);             // not needed, but I like to be explicit
}

void loop()
{
  if(digitalRead(but) == LOW)
  {
    //here: the button is pushed
     val += 20;                                 // increment the brightness of the LED by 1/24th
    val = min(val, 255);                     // maximum PWM value is 255
  }
  else
  {
    //here: the button has been released
    val = 0;                                  // turn the LED OFF
  }

  analogWrite(led,val);                 // adjust the PWM
  delay( 250 );                           // give yourself a chance to see the result
}

should take about 3 seconds from OFF to full brightness. If you need it to be quicker, adjust the delay time
the delay also tends to debounce the switch too
97  Using Arduino / Programming Questions / Re: How do I filter a RNG output to produce biased numbers? on: January 31, 2013, 03:15:58 pm
You need to rethink your basic premise, methinks. You can produce a 1KHz tone for one second, but you can't produce a 1Hz tone for 1/1000th of a second, yes?

Can you re-define your requirements for us? Are you trying to produce white noise?

BTW, what is RNG?
98  Community / Gigs and Collaborations / Re: Peltier Fridge project launching on Indiegogo on: January 31, 2013, 12:45:35 am
I have played with Peltier junctions some and microcontrollers a lot. So, I have some interest in your project.

My experience with Peltiers is that they weren't very efficient.  Is this a commercial project?

I would like to hear more.
99  Using Arduino / Programming Questions / Re: Help with 2x2 matrix button board on: January 30, 2013, 07:46:02 pm
Shouldn't the input pins be digital and not analog?

And the switches should go from the digital pin to GND when pressed, yes?
100  Using Arduino / Programming Questions / Re: a small and easy program but went wrong on: January 30, 2013, 07:27:12 pm
Your code is good! Up to a point.

What is happening is that after you turn both LEDs OFF, you need another delay to see it. Just add another delay(1000) at the bottom of the code.

What is happening right now is that LED1 is turned OFF at the bottom of the code and right back ON at the top.

Good luck!
101  Using Arduino / Programming Questions / Re: Help with 2x2 matrix button board on: January 29, 2013, 10:50:05 pm
I took a quick look and might suggest that in setup() you might want to turn ON the internal pull-up resistors with:
Code:
pinMode(buttonMatrix1, INPUT);
digitalWrite(buttonMatrix1, HIGH);
pinMode(buttonMatrix2, INPUT);
digitalWrite(buttonMatrix2, HIGH);
pinMode(buttonMatrix3, INPUT);
digitalWrite(buttonMatrix3, HIGH);
pinMode(buttonMatrix4, INPUT);
digitalWrite(buttonMatrix4, HIGH);

thus, an unpressed button reads HIGH, and when pressed it would read LOW

Just a thought...
102  Using Arduino / Programming Questions / Re: Compile Error on Simple Subtraction on: January 29, 2013, 10:36:52 pm
Retyped the minus and it all works! I must have cut n pasted at some point. Many thanks.
103  Using Arduino / Programming Questions / Compile Error on Simple Subtraction on: January 29, 2013, 10:18:14 pm
Here is a very simple sketch:
Code:
void setup()
{
  Serial.begin(9600);          // debug write to the USB
}

void loop()
{
  int vR = 0;       // reference voltage
  int vP = 0;               // potentiometer voltage
  int x = 0;                       // difference between the two
   
  vR = analogRead(A0);        // read vR to compare with vP
 
  vP = analogRead(A1);        // read vP to compare with vR

  x = vR – vP;                // calculate the difference
 
  Serial.print(x);            // write difference to console
}

Here are the compiler error messages:
minus:17: error: stray '\' in program
minus.ino: In function 'void loop()':
minus:17: error: expected `;' before 'u2013'

If I comment out the
  x = vR – vP;                // calculate the difference
line (17), it compiles OK.

I tried to search existing posts but didn't find an answer.

What gives???
Pages: 1 ... 5 6 [7]