Show Posts
Pages: 1 ... 14 15 [16] 17 18 ... 243
226  Using Arduino / Programming Questions / Re: Buttons and Led's - Button switching too quickly on: July 25, 2014, 10:58:48 pm
How big of a delay? I can tell you your serial monitor is not going to work correctly because your using digital pin 1. Start at pin 2 instead.

Added:
Should be, for(int i = 0; i < 16; i++) and not, for(int i = 0; i<= 16; i++)
227  Using Arduino / Programming Questions / Re: Buttons and Led's - Button switching too quickly on: July 25, 2014, 10:04:38 pm
:c
You were doing so umm... good with your arrays, why did you stop?
Quote
boolean state1, lastState1 = LOW;
boolean state2, lastState2 = LOW;
boolean state3, lastState3 = LOW;
boolean state4, lastState4 = LOW;
boolean state5, lastState5 = LOW;
boolean state6, lastState6 = LOW;
boolean state7, lastState7 = LOW;
boolean state8, lastState8 = LOW;
boolean state9, lastState9 = LOW;
boolean state10, lastState10 = LOW;
boolean state11, lastState11 = LOW;
boolean state12, lastState12 = LOW;
boolean state13, lastState13 = LOW;
boolean state14, lastState14 = LOW;
boolean state15, lastState15 = LOW;
boolean state16, lastState16 = LOW;

These here can go into FOR loops,
Quote
boolean buttonPress[16]; // No need for zeros here, and should be boolean, unless you are looking for a value between 0 -1023, in which case you would be using type INT and analogRead().
 
long previousMillis[48]; // again no zeros needed here

In your setup() function, you use the FOR loops and set the arrays to zero, just like you did with your pinModes.

In your loop() function, you could use either a FOR loop or IF/ELSE statements and go through each array and change their indexes at the same time.
228  Using Arduino / Project Guidance / Re: Arduino touch lamp control on: July 25, 2014, 06:46:55 pm
Well, I can't say for certain it will work, because it basically a capacitance sensor. The "M" wire detects a slight voltage change, and does an action based on that change.

It only costs $5.63, so you can get one and play with it. CAUTION, it will need 110 volts to work! If this fact makes you uneasy, DON'T DO/GET IT!
229  Using Arduino / Project Guidance / Re: Arduino touch lamp control on: July 25, 2014, 06:37:05 pm
The item in the link you gave already does what you want. Look at the description,
Quote
The Dimmer switch has four ways: Low, medium, high, turn off:
Touch one time: the lamp will be in low light;
Touch again: the lamp will be in medium light;
Touch one more time: the lamp will be in high light;
Touch again: the lamp will be off.
Applicable to the metal body of table lamps, floor lamps, bedside lamps, etc.
Connection: A black line "N" and red line "L" connected to 110V input, the other black line "N" and the Blue Line "L1" connected lights, yellow line "M" then touch the metal body.

What exactly will the arduino do?

Do you want to make the arduino do what that dimmer does?, if so, then its actually very easy.
230  Using Arduino / Programming Questions / Re: Buttons and Led's - Button switching too quickly on: July 25, 2014, 06:15:21 pm
Arrays, ARRAYS... use ARRAYS

You want to have the arduino remember the last button press state, and if the state does NOT change,( high to low or low to high) then don't do anything. Only when the button changes, do something.

You may also need to debounce the buttons too.

I might have something you can use, let me look.

Code:
const byte button = 2;
boolean state, lastState = LOW;

void setup()
{
  Serial.begin(115200);
  Serial.println("Start");
  pinMode(button, INPUT);
}

void loop()
{
  state = digitalRead(button);
 
  if(state != lastState) // only do something if the button state changes, ie. not held down
  {
    lastState = state; // update lastState
    Serial.print("The buttons state is: ");
    Serial.println(state);
   
    if(state == HIGH) // do something ONLY when the buttons state is HIGH
      digitalWrite(13, !digitalRead(13) );
  }
}

231  Using Arduino / Displays / Re: Help Me - 3,5 TFT Touch LCD Screen Display - I can not make it work, help. on: July 25, 2014, 03:54:34 pm
Thats because you need a proper library that has all the functions you're looking for. You can try your luck with the UTFT and UTouch libraries provided HERE, but other then that, YOU need to make the functions yourself.

To be honest, all you really need is a way to make a pixel on the screen and be able to add color to that pixel. The rest will come afterwards.
232  Using Arduino / Displays / Re: Help Me - 3,5 TFT Touch LCD Screen Display - I can not make it work, help. on: July 25, 2014, 02:36:47 pm
But you have a working code, so now add to it. That is an third party LCD, so there may not be a library for it, which means you need to make your own functions. and/or library.

What else are you trying to do with it?
233  Using Arduino / Programming Questions / Re: Unexpected behavior with RF receiver code on: July 25, 2014, 01:48:14 pm
If anyone copies the code straight from there, it will not work. Repost the code and put it in the proper tags. Code tags
234  Using Arduino / Programming Questions / Re: How to send and recieve data via 433MHZ module on: July 25, 2014, 11:52:58 am
The answer to your question is in your link. Its a basic serial connection of which, you can use software serial.

Look at the PDF. http://www.fut-electronics.com/wp-content/plugins/fe_downloads/Uploads/Wireless-Serial-UART-Arduino.pdf
235  Using Arduino / Programming Questions / Re: How to send and recieve data via 433MHZ module on: July 25, 2014, 10:29:18 am
Do you have a link to your transmitter/receiver?
236  Using Arduino / Programming Questions / Re: Multiple buttons for State Changes - Rgb led strips on: July 23, 2014, 09:10:23 pm
You can cut down your pin usage by using shift registers and a 16-4 encoder for your buttons.
Look at these links.
http://www.instructables.com/id/64-pixel-RGB-LED-Display-Another-Arduino-Clone/

https://www.youtube.com/watch?v=QIZX8qZ6nlE


Added:
Quote
Why not just have one function and pass in the value for the denominator?
This was meant for Bulldog

Quote
code was for demonstration purposes only... a visualization of how to approach the problem
Ok, that's fair enough.
237  Using Arduino / Programming Questions / Re: Multiple buttons for State Changes - Rgb led strips on: July 23, 2014, 08:52:52 pm
Why not just have one function and pass in the value for the denominator?
238  Using Arduino / Programming Questions / Re: Unexpected behavior with RF receiver code on: July 23, 2014, 08:49:57 pm
Quote
421 > delayLeft > 0
this doesn't look correct to me. This however does, (421 > delayLeft) && (delayLeft > 0), it might not solve your entire problem, but its a start.

I'll go over the code some more.  Could you post the FULL code please?

Added:
When does bufVal get updated to the new buf value?
239  Using Arduino / Programming Questions / Re: Multiple buttons State Changes - Rgb led on: July 23, 2014, 08:46:08 pm
What is your setup, what board are you using and  what LED driver/shift register are you using? Do you have a sketch you are currently working on and can you provide us with pictures and/or a complete schematic.

Your problem sounds like it has an easy solution, but we don't know your exact hardware to be certain.
240  Using Arduino / Programming Questions / Re: Using an array in a switch case on: July 23, 2014, 08:21:40 pm
Quote
For one, the array needs to be 2D (char states[4][6], not char states[4]) to work with my previously written code.
If you had posted the previous code and said you needed them to work together, I would have given you exactly what econjack gave you.
Pages: 1 ... 14 15 [16] 17 18 ... 243