Show Posts
Pages: 1 ... 35 36 [37] 38 39 ... 252
541  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 20, 2014, 01:16:18 pm
The library is no good, we can give you the code to add the delay in properly, but in the end, even that may not work.

EDIT:
The thing is, in the code I gave you, I added basically a lockout condition. This lockout checks to see if the data is the same or if it has changed and if it is different then it shows it. But even that did not work.


What needs to be printed, where and duration.
542  Using Arduino / Programming Questions / Re: Arduino Won't Change EEPROM Setting. on: June 20, 2014, 09:18:32 am
Quote
I wonder why the script compiled with the missing second equal sign.
Because the compiler doesn't see it as being wrong, it sees the one equal sign and "thinks" you want to assign 1 to the variable x, when what you really want to do is compare them.
543  Using Arduino / Programming Questions / Re: need help in my programe . on: June 19, 2014, 08:51:35 pm
What values does it print to the serial monitor when you first turn it on?
544  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 19, 2014, 04:27:32 pm
Put a 1 second delay in the function, and see if it still blinks
545  Using Arduino / Programming Questions / Re: incrementally declaring variables on: June 19, 2014, 08:16:42 am
Pyro is correct, it won't work the way I said.

I tested it with an online simulator.
Code:
#include <iostream>

using namespace std;
#define SIZE(x) (sizeof(x)/sizeof(x[0]))

int array[] = { 25,84,36,95,1};
void printArray(int Arr[]);


int main()
{
   cout << SIZE(array) << endl;
   printArray(array);
  
   return 0;
}

void printArray(int * Arr)
{
   for(int i = 0, j = SIZE(Arr); i < j; i++)
   {
    cout << Arr[i]<< endl;
   }
}

Output:
Quote
Executing the program....
$demo
5
25
84

However with this, I got the following.
Code:
#include <iostream>

using namespace std;
#define SIZE(x) (sizeof(x)/sizeof(x[0]))

int array[] = { 25,84,36,95,1};
void printArray(int size, int * Arr);

int main()
{
   cout << SIZE(array) << endl;
   printArray(SIZE(array), array);
  
   return 0;
}

void printArray(int _size, int * Arr)
{
   for(int i = 0; i < _size; i++)
   {
    cout << Arr[i]<< endl;
   }
}

Output:
Quote
Executing the program....
$demo
5
25
84
36
95
1
546  Using Arduino / Project Guidance / Re: LCD menu's on: June 19, 2014, 06:27:50 am
Yea, but the way you showed, looked like you wanted the button to do different things when pressed multiple times.
547  Using Arduino / Audio / Re: Can anyone recommend a voice recognition module? on: June 18, 2014, 10:38:34 pm
Its decent within a 1 foot distance, you just need I speak very clearly.
548  Using Arduino / Programming Questions / Re: Arduino Won't Change EEPROM Setting. on: June 18, 2014, 09:27:41 pm
In IF statements, to compare anything you use == not a single =. Tell me from that code, can you read from the EEPROM?
549  Using Arduino / Project Guidance / Re: LCD menu's on: June 18, 2014, 07:34:11 pm
Use switchVar1 in a IF statement to increment a counter that cycles through the cases.
550  Using Arduino / Project Guidance / Re: LCD menu's on: June 18, 2014, 07:07:15 pm
Can you post a picture?
551  Using Arduino / Project Guidance / Re: LCD menu's on: June 18, 2014, 06:10:02 pm
Code:
byte shiftRegister()
{
  digitalWrite(backLight, HIGH);
 
  digitalWrite(latchPin, HIGH);
  delayMicroseconds(20);
  digitalWrite(latchPin, LOW);

  return shiftIn(dataPin, clockPin, MSBFIRST);
}

void loop()
{
  switchVar1 = shiftRegister(); // this should return 0 if nothing is pressed, if it constantly returning a value then something is wired wrong.

  if (switchVar1 == 32)
  {
    lcd.setCursor(0,1);
    lcd.write(Symbol_2);
  }
}
552  Using Arduino / Project Guidance / Re: LCD menu's on: June 18, 2014, 05:40:04 pm
Quote
the problem is, is that i want the shift register input values to do more than one thing
So call the shiftRegister function where you need it.

For the main menu, you can use case statements, and when you need to switch into the sub-menus, you call the shiftRegister function again.
553  Using Arduino / Displays / Re: Problem with initializing TFT on: June 18, 2014, 02:20:25 pm
I think it was changed to only require CS, DC and RST. However if you use the Adafruit library you can use what you have.

Quote
Adafruit_ST7735::Adafruit_ST7735(uint8_t cs, uint8_t rs, uint8_t sid,
 uint8_t sclk, uint8_t rst) {
  _cs   = cs;
  _rs   = rs;
  _sid  = sid;
  _sclk = sclk;
  _rst  = rst;
  hwSPI = false;
}
554  Using Arduino / Programming Questions / Re: Getting a steady output on a 1602 LCD display on: June 18, 2014, 02:05:29 pm
Try this.

Code:
#include <ShiftLCD.h>

ShiftLCD lcd(9, 11, 10);                                                                                                                                 //initializing the LCD adapter pins
unsigned int lightOutput[17] = {1, 0, 0, 8, 0, 0, 64,0, 254, 512, 0, 2048,0, 0, 0, 0, 0};         //for testing
unsigned int outputL = 0;
unsigned int lastInt = 0;

void setup() {
  // put your setup code here, to run once:
  lcd.begin(16, 2);
}

void loop() {
  // put your main code here, to run repeatedly:
  outputL = 0;
  for(int i=0; i < 17; i++)
  {                                           //loop through the light output array
       outputL += lightOutput[ i ];                            //adding up the numbers
  }                                             
  printBinary16(outputL);                                  //sending  the result to dislplay

}

void printBinary16(unsigned int iIn)
{
  if( iIn != lastInt)
  {
    lastInt =  iIn;
    byte hiByte = highByte(iIn);
    byte loByte = lowByte(iIn);
    int binValue = word(hiByte, loByte);

    for(int i=15; i>=0; i--)
    {
      lcd.setCursor(15-i, 0); // these might be backwards
      lcd.print( bitRead(binValue, i));
    }
  }
}
555  Using Arduino / Project Guidance / Re: Which Shield is Better to use Keyboard as an Input For Arudino on: June 18, 2014, 01:36:20 pm
Quote
what I should do to make the Computer give instructions to the Arduino like (WASD) Keys to go forward, back, left and right.

Yes, unless you have a joystick or gamepad that can send the commands instead.

edit:
From your computer, you can send WASD with a terminal program like puTTY and the arduino will need to receive that key( char pressed) and do the function assigned to it. You can use IF/ELSE statements or CASE statements.

Do you plan on sending multiple keys like "WA" to go forward and to the left?
Pages: 1 ... 35 36 [37] 38 39 ... 252