Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 196
61  Using Arduino / Project Guidance / Re: Creating a bluetooth controller on: April 03, 2014, 08:29:22 pm
The default baud rate is usually 9600. Also from my experience, if they are blinking then they are not connected, only when the LED is solid, are they connected.
62  Using Arduino / Programming Questions / Re: Real Time Key control on: April 02, 2014, 09:07:21 pm
The program Putty will allow you to do that, you will just need to code it so if no key is pressed it sends a stop key 'w'.
63  Using Arduino / Programming Questions / Re: Question about Scroll Display Left on: April 02, 2014, 03:39:15 pm
This is what I came up with. I modified another users sketch that I had.
You will need to change a few things to get it to work on your screen. Also it would be better if this was made into a class.

Code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define N_CHARS  ((sizeof(Compass)/sizeof(Compass[0]))-1)

LiquidCrystal_I2C lcd(0x20,20,4);  // set the LCD address to 0x20 for a 16 chars and 2 line display

char Compass[21] = {
  "N....E....S....W...."};
 
int index = 19, index2 = 0;
unsigned long time = 0, time2 = 0;

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.backlight();
}

void loop()
{
  setHeadingRight(0, 1000);
  setHeadingLeft(1, 500);
}

void setHeadingRight(byte row, unsigned long duration)
{
  if(millis() - time > duration)
  {
    time = millis();
    if(index >= 0)
    {
      index--;
      for (int i = 0; i < N_CHARS; i++)
      {
        lcd.setCursor(i,row);
        if(index == N_CHARS) index = 0;
        lcd.print(Compass[index++]);
      }
    }
    else index = 19;
  }
}

void setHeadingLeft(byte row, unsigned long duration2)
{
  if(millis() - time2 > duration2)
  {
    time2 = millis();
    if(index2 < 20)
    {
      index2++;
      for (int i = 0; i < N_CHARS; i++)
      {
        lcd.setCursor(i,row);
        if(index2 == N_CHARS) index2 = 0;
        lcd.print(Compass[index2++]);
      }
    }
    else index2 = 0;
  }
}
64  Using Arduino / Programming Questions / Re: Question about Scroll Display Left on: April 02, 2014, 02:47:46 pm
I don't think it will work even like that. The scrollDisplay functions will move whatever is on the screen. I'll try something on my end but I still don't think it will work.
65  Using Arduino / Programming Questions / Re: Question about Scroll Display Left on: April 02, 2014, 02:17:18 pm
No, for that you would need to make you own function. What you can do is make a table (array) of everything that is to go on the screen, then you can move whatever you want in the array then update the screen.

66  Using Arduino / Project Guidance / Re: rf Transmission Problems on: April 02, 2014, 01:29:15 pm
You shouldn't be using pins 1 or 0, if your using the serial monitor. Use another pin like pin 2
67  Using Arduino / Project Guidance / Re: rf Transmission Problems on: April 02, 2014, 11:23:04 am
Those only do one way communication. The smaller one is the transmitter and even though the bigger one has two data pins, only one is needed.

Also make sure the receiver is getting 5 volts and not 3.3.
68  Using Arduino / Project Guidance / Re: How to merge to codes and let them function sequentially on: April 01, 2014, 08:06:38 pm
Ok you need to get rid of this stuff and use the Keypad library.
Quote
  pinMode(r1,OUTPUT);
  pinMode(r2,OUTPUT);
  pinMode(r3,OUTPUT);
  pinMode(r4,OUTPUT);

  pinMode(c1,INPUT);
  pinMode(c2,INPUT);
  pinMode(c3,INPUT);
  pinMode(c4,INPUT);
.
.
.
digitalWrite(c1,HIGH);
  digitalWrite(c2,HIGH);
  digitalWrite(c3,HIGH);
  digitalWrite(c4,HIGH);

  //checking everything one by one
  //case 1: col1 =0 while other col as 1
  digitalWrite(r1,LOW);
  digitalWrite(r2,HIGH);
  digitalWrite(r3,HIGH);
  digitalWrite(r4,HIGH);

Don't use String,
Quote
String key="";
String s;
String pass="1234";
Instead, use C strings which are char arrays. Actually you can combine the password library with Keypad library so it makes things easier for you.

I'm not sure why you have two of these,
Quote
Serial.begin(9600);
lcd.begin(16,4);

And you can combine all the different setups and loops into one setup() and loop(), also this too,
Quote
#include <Adafruit_Fingerprint.h>
#if ARDUINO >= 100
#include <SoftwareSerial.h>
#else
#include <NewSoftSerial.h>
#endif

#if ARDUINO >= 100
SoftwareSerial mySerial(51, 50);
#else
NewSoftSerial mySerial(51, 50);
#endif

You said things are not working correctly, that could be because of the delay( ); functions in your code. Look into the Blink Without Delay sketch.

These are all things you can actually do yourself if you sit down and take the time to understand what does what.
69  Using Arduino / Programming Questions / Re: Storing Data permanently on: April 01, 2014, 07:28:12 pm
No your correct, but you have a limited amount of times you can read and write to the EEPROM before it is unusable. Your better off getting an external EEPROM chip and use that instead. Many can be found online and come with libraries for the Arduino.
70  Using Arduino / Programming Questions / Re: Bluetooth as a push button on: April 01, 2014, 05:02:43 pm
Quote
Not a good idea. How will you determine how often to send the space?
Well it could just be as simple as checking to see if any key is pressed or not. If a key (wasd) is pressed then send it out, otherwise send out something that isn't one of the keys the code is looking for. He can code it to just send out one stop key or a continuous stream. He could even press 'x' and send it out to stop the motors.

Its up to him as to what he wants to do. Also he didn't say what he was using to send the chars in the first place, so he could already be sending out a NULL char and just not be looking for it. Who knows. :/
71  Development / Other Software Development / Re: New TFT Extension Library on: April 01, 2014, 04:17:37 pm
Small update, I changed TouchDelay to TouchDelayButton and added two new functions, TouchDelayCircle and TouchDelayTriangle.

I'm still working on the TextButton function, I am able to display text in the center with no problem, but I am trying to make the button be able to rotate (Still no problem). However, getting the text to rotate and still stay centered is proving to be a bit more challenging then expected. I will hopefully get that function working soon.

EDIT: There was a slight hiccup with the Portrait vs Landscape modes. Its fixed now.
72  Using Arduino / Programming Questions / Re: Bluetooth as a push button on: April 01, 2014, 01:03:52 pm
Quote
my BluetoothData variable is set as an integer
Your bluetooth module should be sending out chars, not ints.
But I can see where the problem is and it's with this line here, "int BluetoothData; // the data given from Computer"
BluetoothData should be type char not int. In fact you're already comparing it to chars in your IF statements.
Quote
BluetoothData == 's'

All you need to do now is make it so a space char is sent out when no button/key is pressed.
73  Using Arduino / Programming Questions / Re: I really need some help on this project on: March 31, 2014, 05:54:31 pm
You can changed these to boolean because you are only checking for a 1 or 0.
Quote
  int S0 = digitalRead(3);//digitalRead(2);
  int S1 = digitalRead(3);
  int S2 = digitalRead(4);
  int S3 = digitalRead(5);
  int S4 = digitalRead(13);
  int S5 = digitalRead(12);
  int S6 = digitalRead(11);
  int S7 = digitalRead(8 );
  int S8 = digitalRead(6);
  int S9 = digitalRead(6);

And you can also do this.
if(S0 & S1 & S2 & S3 & S4 & S5 & S6 & S7 & S8 & S9)  // this will be true if all are true / 1

You can also get creative with a FOR loop and a little multiplication. Also instead of using S0 ... S9, you can use an array.
74  Using Arduino / Programming Questions / Re: I really need some help on this project on: March 31, 2014, 05:37:37 pm
You really need to clean up your code. Please format it with CTRL+T.

One thing that will help us, is comments. What sensors do what? Which ones are the left side, which are the right side and what is the center?

This is not needed if you know what sensors are what variable and your can split this into three functions. Left side, right side and center.
Quote
(S0==1 && S1==1 && S2==1 && S3==1 && S4==1 && S5==1 && S6==1 && S7==1 && S8==1 && S9==1) || (S0==0 && S1==0 && S2==0 && S3==0 && S4==0 && S5==0 && S6==0 && S7==0 && S8==0 && S9==0))
75  Development / Other Software Development / Re: New TFT Extension Library on: March 30, 2014, 04:18:58 pm
Here are the times for the radio button color functions.
Code:
#include <ITDB02_Graph16.h>
#include <ITDB02_Touch.h>
#include <TFT_Extension_old.h>
#include <math.h>
// Declare which fonts we will be using
extern uint8_t SmallFont[];

//myGLCD(RS,WR,CS,RST,ALE,mode);
ITDB02 myGLCD(A1,A2,A0,A3,A5,ITDB32S);
//myTouch(TCLK,TCS,DIN,DOUT,IRQ);
ITDB02_Touch  myTouch(13,10,11,12,A4);
TFT_Extension_old myTFT(&myGLCD, &myTouch, LANDSCAPE);

unsigned long timeStart, timeCollect[13];
char * functs[13] = {
  "Set RBO color: ", "Set RCBO color: ", "Set RBT color: ", "Set RCBT color: ",
  "Set RBUT color: ", "Set RCBUT color: ", "Set RBO_BG color: ", "Set RCBO_BG color: ",
  "Set RBT_BG color: ","Set RCBT_BG color: ", "Set RBUT_BG color: ","Set RCBUT_BG color: ",
  "Total Time: "};
void setup()
{
  myGLCD.InitLCD(LANDSCAPE);
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myTouch.InitTouch(LANDSCAPE);
  myTouch.setPrecision(PREC_LOW);
  Serial1.begin(115200);
  startup();
}

void loop() {
}

void startup()
{
  myGLCD.setColor(255, 0, 0);//red box fill
  myGLCD.fillRect(0, 0, 319, 13);//text box
  myGLCD.setColor(255, 255, 255);//text color White
  myGLCD.setBackColor(255, 0, 0);//background of text red
  myGLCD.drawLine(0, 14, 319, 14);
  myGLCD.print("LatchButtons", CENTER, 1);
  myGLCD.setBackColor(0, 0, 0);
  myGLCD.print("Touch screen to start", CENTER, 119);
  myGLCD.clrScr();
  myGLCD.print("Latches", CENTER, 50);
  myGLCD.print("Buttons", CENTER, 170);

  timeStart = micros();
  myTFT.RB_Outer_Color(0,1,WHITE);
  timeCollect[0] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RCB_Outer_Color(0,1,WHITE);
  timeCollect[1] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RB_Toggled_Color(0,1,WHITE);
  timeCollect[2] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RCB_Toggled_Color(0,1,WHITE);
  timeCollect[3] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RB_Untoggled_Color(0,1,WHITE);
  timeCollect[4] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RCB_Untoggled_Color(0,1,WHITE);
  timeCollect[5] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RB_Outer_Color_By_Group(1, GREEN);
  timeCollect[6] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RCB_Outer_Color_By_Group(1, GREEN);
  timeCollect[7] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RB_Toggled_Color_By_Group(1, GREEN);
  timeCollect[8] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RCB_Toggled_Color_By_Group(1, GREEN);
  timeCollect[9] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RB_Untoggled_Color_By_Group(1, GREEN);
  timeCollect[10] = micros() - timeStart;
 
  timeStart = micros();
  myTFT.RCB_Untoggled_Color_By_Group(1, GREEN);
  timeCollect[11] = micros() - timeStart;
  timeCollect[12] = micros() - timeCollect[0];
  myGLCD.clrScr();
  for(byte idx = 0; idx < 13; idx++)
  {
    myGLCD.print(functs[idx], 0, idx * 16);
    myGLCD.printNumF((float(timeCollect[idx]) / 1000.00),6, 200, idx * 16 );
  } 
}

Output:
Quote
Set RBO color:  .00799
Set RCBO color: 0.00799
Set RBT color: 0.00799
Set RCBT color: 0.00799
Set RBUT color: 0.00799
Set RCBUT color: 0.00799
Set RBO_BG color: 0.00399
Set RCBO_BG color:  0.00799
Set RBT_BG color: 0.00399
Set RCBT_BG color: 0.00399
Set RBUT_BG color: 0.00799
Set RCBUT_BG color: 0.00399
Total Time: 0.07988
Pages: 1 ... 3 4 [5] 6 7 ... 196