Show Posts
Pages: 1 ... 44 45 [46] 47 48 ... 243
676  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 29, 2014, 10:31:52 pm
ok, being that your getting a range, you might need to have something like this.

if(button != lastState && (button2 > 20 && button2 < 50) )
{
  .
  .
  .
}

I don't think you should be reading it as an analog signal, because now you will need to get averages of the readings to smooth them out. Stick with digital for now.
677  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 29, 2014, 09:16:00 pm
Ok, now you can start to debug your code with the serial monitor. What is button2's value and is it constant?
678  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 29, 2014, 07:39:27 pm
Make lastState2 an int instead of boolean and it is still !=
679  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 29, 2014, 07:23:33 pm
These should be !=
Quote
if ( button != lastState && button2 !< lastState2)
                                      ^
forum project help.ino:18:6: note: to match this '('
  if ( button != lastState && button2 !< lastState2)
680  Using Arduino / Project Guidance / Re: First project, building a RC-car on: April 28, 2014, 10:34:50 pm
Quote
My mistake, inputs only.  Can't control with that.
Wrong again, they are both inputs and outputs but only for digital purposes. However you can NOT output an analog signal from them or use the standard PWM.
681  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 10:31:17 pm
Im not an expert when it comes to shift registers or charlieplexing, but another user, CrossRoads may be able to help in that area.
682  Development / Other Software Development / Re: New TFT Extension Library on: April 28, 2014, 10:13:29 pm
Apparently there was an issue with my ConnectFour game that I was unaware of. Here is the fixed version.
Sorry about that.

Added: I decided to make a Bluetooth chat sketch, with a decent looking keyboard and functionality, and so far the results are very promising. Right now it has all the lower case keys plus a working shift key which capitalizes the keys and stores them into a buffer array. I will add all the symbols [~!@#$%^&*()_+] too, but no F1 - F12 keys.

!!! The keyboard is done and working, and it is a new library function. : }
683  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 09:42:25 pm
A shift register will work, and you could also use the charlieplexing method too.
What shift register are you using? Take a look at the MAX7219, it may help you.
684  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 09:31:18 pm
Try this.
Code:
byte LEDpin = 13; //on-board LED
byte ButtonPin = 2; //digital pin 2
byte ButtonPin2 = 3;
boolean button, lastState = LOW;
boolean button2, lastState2 = LOW;
boolean latch = false;

void setup() {
  pinMode(LEDpin, OUTPUT);
  pinMode(ButtonPin, INPUT);
  pinMode(ButtonPin2, INPUT);
}

void loop()
{
  button = digitalRead(ButtonPin);
  button2 = digitalRead(ButtonPin2);
  if ( button != lastState && button2 != lastState2)
  {
    if(button == HIGH && button2 == HIGH )
      latch = !latch;


    if(latch == true)
      digitalWrite(LEDpin, HIGH);
    else
      digitalWrite(LEDpin, LOW);

    lastState = button;
    lastState2 = button2;
  }
}
Once you get this to work, you then need to put everything into arrays.
685  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 06:31:26 pm
Did you look at my latching example? It shows you how to latch a state on when the button is pressed once then off, when it is pressed again. You can do the exact same thing, but you will need to add in the variables for the second sensor.
686  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 05:45:02 pm
For two sensors, you would need to use some logic.  (AND, OR, equal "==", not equal "!=", greater/less than <>)
For you, I already gave you that logic statement.
Quote
if(digitalRead(sensor_1) == HIGH && digitalRead(sensor_2) == HIGH)
{
  // If both sensors are blocked, turn on LED
  //LED = HIGH
}
else
{
  // otherwise the LED should be turned off.
  //LED = LOW
}
687  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 04:26:06 pm
if(digitalRead(sensor_1) == HIGH && digitalRead(sensor_2) == HIGH)
{
  //LED = HIGH
}
else
{
  //LED = LOW
}

Latching example for one button.
Code:
byte LEDpin = 13; //on-board LED
byte ButtonPin = 2; //digital pin 2

boolean button, lastState = LOW;
boolean latch = false;

void setup() {
  pinMode(LEDpin, OUTPUT);
  pinMode(ButtonPin, INPUT);
}

void loop()
{
  button = digitalRead(ButtonPin);
  if (button == HIGH && button != lastState)
  {
    latch = !latch;
   
    if(latch == 1)
      digitalWrite(LEDpin, HIGH);
    else
      digitalWrite(LEDpin, LOW);
     
    //latch ? digitalWrite(LEDpin, HIGH): digitalWrite(LEDpin, LOW); //Equal to above IF/ELSE statement.
  }
  lastState = button;
}

Since you will be using multiple sensors, you need to use arrays of the all sensor pins and two FOR loops to cycle through them. Make sure you make arrays for the "lastStates" too.
Sensor_Col[5] = { . . . };
Sensor_Row[5] = { . . . };
688  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 04:06:49 pm
I should have asked for you to format your code too with CTRL+T.

What do your sensors return when they are blocked? Do they return a range, or just a HIGH or LOW signal?

Have you tried to simply block one sensor to change the state of an LED? Starting small usually leads to bigger and better things.

You need to first see what the sensors return, and second use an IF statement to see if both sensors are blocked at the same time. If both are blocked LED = HIGH, else LED = LOW.
689  Using Arduino / Project Guidance / Re: Need help for my arduino project PLEASE ANYONE! on: April 28, 2014, 03:11:27 pm
Sounds to me like you need a latch, but I won't know for certain unless you post your code. Please put your compiled sketch in code tags, of which can be obtained with the # sign above the smiley faces. If you have any errors from the compiler, please post them too.

690  Development / Other Software Development / Re: New TFT Extension Library on: April 28, 2014, 11:59:01 am
UPDATE:

Functions added:
   rounded_Square   :: robtillaart
   drawMoon              :: robtillaart
   smiley_Face          :: robtillaart
   HourGlass               :: robtillaart
   SpeechBubble        :: robtillaart

   drawGauge             :: cyclegadget

My own new functions:
  Triangle : Bare basic make-a-triangle function
  fillPoly : Basically a fill triangle function
  drawOvalArc : See the example sketch, MoonLightPark
----------------------------------------------------

I moved the variable Thickness next to radius in both TouchArc and drawArc.
Polygon and drawStar now are able to be filled

And I am still working on making the SpeechBubble have multiple lines of text.

If anyone has anymore ideas for functions they would like to add to the library, let me know and I will add them.

**Currently working on the Greek Font and symbols.
Pages: 1 ... 44 45 [46] 47 48 ... 243