Show Posts
Pages: [1] 2 3 ... 244
1  Using Arduino / Project Guidance / Re: I'm trying to make a pole move, fast on: September 01, 2014, 09:39:29 pm
An air piston maybe? What is this for?
2  Using Arduino / Project Guidance / Re: Countdown Timer Help Please on: September 01, 2014, 08:30:57 pm
The button is wired to be brought low when pressed, not high.
3  Using Arduino / Project Guidance / Re: Countdown Timer Help Please on: September 01, 2014, 08:22:19 pm
Did you try the code I posted?
4  Using Arduino / Project Guidance / Re: Countdown Timer Help Please on: September 01, 2014, 07:50:36 pm
Have you taken a look at the Blink without Delay example sketch?

You can play around with this.
Code:
const byte buttonPin = 2;
int timer = 15;
uint16_t prevTime = millis();

void setup()
{
  Serial.begin(115200);
  pinMode(buttonPin, INPUT_PULLUP);
}

void loop()
{
  byte button = digitalRead(buttonPin);
  if((millis() - prevTime >= 1000) && (button == LOW) && (timer >= 0))
  {
    prevTime = millis();
    Serial.println(timer);
    timer--;
  }
  if((timer <= 0) && button == HIGH)
    timer = 15;
}

5  Using Arduino / Programming Questions / Re: Push button timer and LCD readout sketch needed on: September 01, 2014, 07:32:24 pm
The other day was the first time I ever saw your post, so this
Quote
No you were not or you would have a while back.
is 100% BS.

I did have a simple solution for you, but now I am choosing to ignore you.

Quote
Eric Carlton
?
I hope that was a typo, because its Eric Cartman.
6  Using Arduino / Programming Questions / Re: Manipulating sequence numbers received through the serial port. on: September 01, 2014, 07:20:11 pm
I am home now.

This is if the data you're sending is sent as individual chars and not just bytes.
Code:
byte Red=0, Green=0, Blue=0, Counter = 0;

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  if(Serial.available() >= 9) // see if 9 chars are in the buffer
  { 
    Counter = 0; // make sure the counter is set to 0
    Red = Green = Blue = 0; // reset the color variables
   
    while(Counter <= 9) // while the counter is less than or equal to 9, read the chars from the buffer
    {
      char Tmp = Serial.read(); // read chars from buffer

      switch( Counter / 3) //changed
      {
      case 0:
        Red = Red * 10 + (Tmp - '0'); // convert the chars into integers
        break;

      case 1:
        Green = Green * 10 + (Tmp - '0');
        break;

      case 2:
        Blue = Blue * 10 + (Tmp - '0');
        Serial.print(Red);Serial.print(Green);Serial.println(Blue);
        break;
      }
      Counter++; // increment the counter
    }
  }
}
7  Using Arduino / Programming Questions / Re: Merging Bluetooth initializer code with running code on: September 01, 2014, 06:44:21 pm
I didn't change anything with the bluetooth coding. Maybe change Serial.begin(115200) back to 9600.
8  Using Arduino / Programming Questions / Re: Manipulating sequence numbers received through the serial port. on: September 01, 2014, 03:21:58 pm
Ok, so instead of using the module operator just use division.
switch( Counter / 3 )
9  Using Arduino / Programming Questions / Re: Manipulating sequence numbers received through the serial port. on: September 01, 2014, 03:00:05 pm
Something like this is all that is needed. Not tested and more is needed to be added in for a full working code. I am not home to complete this, so could someone else finish this? Thank you.

Code:
byte Red=0, Green=0, Blue=0, Counter = 0;

void setup()
{
  Serial.begin(115200);
}

void loop()
{
  if(Serial.available() >= 9)
  {
     char Tmp = Serial.read();
     Counter++;
     
     switch( Counter / 3) //changed
     {
         case 0:
              Red = Red * 10 + (Tmp - '0');
              break;
   
         case 1:
              Green = Green * 10 + (Tmp - '0');
              break;

         case 2:
              Blue = Blue * 10 + (Tmp - '0');
              break;
         }
     }
     else
        Counter = 0;

     /* write a piece that resets the colors back to zero for the next sent string */
}
10  Using Arduino / Programming Questions / Re: Manipulating sequence numbers received through the serial port. on: September 01, 2014, 01:42:47 pm
I wa refering to what I wrote in reply #3 of that link, but if the data IS always 9 characters long then a simple counter and the uses of the module operator will be perfect for your solution.

See if the serial buffer(Serial.available() ) has first collected 9 chars, then once it has read them in one at a time and increment a counter. You can use an array to store the 3 chars and use atoi() to convert the chars into an actual integer. Then using if(counter % 3) you can change to the next variable.

Rinse and repeat.
11  Using Arduino / Programming Questions / Re: Manipulating sequence numbers received through the serial port. on: September 01, 2014, 12:49:54 pm
Is the data consistent, even if you send all zeros?

Try the method in this post Here
12  Using Arduino / Project Guidance / Re: How to programme robot arm positions on: September 01, 2014, 11:55:55 am
Well you can use the Knob example. Use a potentiometer to manually move the servo to where you want it to go, track the position of it with the serial monitor then write down the values of where you think the servo should be.

This method does take some time, especially if you have to move multiple servos, but it works out in the end.

Once you have all the servo(s) positions, write the code that moves the servos when needed.
13  Using Arduino / Programming Questions / Re: Serial.readString() is extremely slow on: September 01, 2014, 02:20:24 am
Not to start anything, just pointing something out for those who read this thread and are just learning about Strings and strings. What you do after looking at the following code is up to you.

Code:
//Uncomment (one at a time) to see the difference in memory used
  //String text = "Hello World"; //  3,518 total bytes -> 1,648 bytes + base line
  //char text[] = "Hello World";// 1,964 total bytes -> 94 bytes + base line
  //char * text = "Hello World";// 1,970 total bytes -> 100 bytes + base line

void setup()
{
  Serial.begin(115200);    //base line 1,870 bytes with next line commented out.          
  Serial.print(text);      // .print('0') -> 1,904 bytes : .print("0") -> 1,954 bytes
}

void loop() { }
14  Using Arduino / Displays / Re: lcd cell count on: September 01, 2014, 12:56:45 am
The screen doesn't give any feedback, so unless you keep track of what you display (using some kind of counter or quite simply an array), there is no way of knowing what is in each cell.
15  Using Arduino / Programming Questions / Re: Merging Bluetooth initializer code with running code on: September 01, 2014, 12:31:54 am
Did you not learn anything from the code I gave you? Yes, I know you are new to this, but if you took the time to actually look and try the code I gave you, you would not be having your issue. (Of which has nothing to do with a missing closing bracket } )

BTW, it should be:
char det = check; // what is check, another variable?
Pages: [1] 2 3 ... 244