Show Posts
Pages: 1 [2] 3 4 ... 196
16  Using Arduino / Motors, Mechanics, and Power / Re: 3 phase motor Control !! on: April 13, 2014, 02:11:58 pm
If your expecting us to write the code for you, then your out of luck. You write the code and we give feedback.

Is this homework, because we don't do that either.
17  Development / Other Software Development / Re: New TFT Extension Library on: April 11, 2014, 06:10:18 pm
UPDATE:
Both types of radio buttons now are able to have text in the center of them. Please note that the text will NOT be cutoff or the buttons size will NOT be altered if the text is larger than the button.

Newest version as of 4/11/2014


I am open to new function ideas if anyone has any. I will of course add your name or username to the functions description.

I am currently working on a star function and I should be done with it soon. As well as a polygon function which will allow the user to enter a number 3 - 10, and it will make the shape with the given sides. Filled in color may be difficult so for now it will just be unfilled.

Added: I finished both of them. They will be in the next update.
18  Using Arduino / Project Guidance / Re: SERVO and Serial Communication on: April 11, 2014, 12:31:05 pm
Quote
for(pos=180;po=0;pos--)
The condition must be either pos == 0, pos >= 0, pos <= 0, or pos != 0.

No insults needed, but maybe a few face palms are.
19  Using Arduino / Project Guidance / Re: SERVO and Serial Communication on: April 11, 2014, 12:00:54 pm
No, his sketch works fine. I have it running on my nano and I also have that exact servo model too. How is the servo being powered?

@Raschemmel
No, it exits the for loop when the condition is false.
20  Using Arduino / General Electronics / Re: LED grid on: April 11, 2014, 11:47:01 am
Quote
(convert all the negative voltages to positive)
What negative voltages? Where is the analog signal coming from? What does this have to do with an Arduino? Can you post a picture or drawing of this grid?

What your describing sound like a voltage or signal meter which can easily be done on an arduino. This can also be done with some simple comparator chips, like a LM339 or LM324, both of which can be bought at RadioShack or online.

21  Using Arduino / Project Guidance / Re: Need help choosing: Arduino + LCD + keyboard + RTC + 8 relays on: April 09, 2014, 10:22:23 pm
Quote
For the LCD I was looking at SainSmart LCD 1602 Keypad Shield.
That should be fine and there is also a library that allows you to make a menu system. I'm not sure if there is a menu library made just for that type of shield or not but the normal menu library should work just fine.

There are plenty of relay boards online with different numbers of relays you can control (1,2,4,8,16) Im sure you can find one that fits your needs.

We can help give feedback on your sketch and help with the code, but you will need to research everything yourself.
22  Using Arduino / Programming Questions / Re: timer on graphic lcd on: April 09, 2014, 10:13:50 pm
You would need to download the SerialGraphicLCD library to display text on the screen, after that is it really easy.
23  Using Arduino / Programming Questions / Re: Parallax Ping Fun on: April 08, 2014, 09:53:11 pm
You don't seem to have set up the pin for the LED. Where is the pinMode in your setup() function for the LED?
24  Using Arduino / Programming Questions / Re: LiquidCrystal_I2C error on: April 08, 2014, 09:31:37 pm
Quote
CustomChars:22: error: 'LiquidCrystal_I2C' does not name a type
The compiler is unable to find the library, make sure it is in a "libraries" folder in the Arduino Sketch folder under your MyDocuments. I don't know about a MAC, I assume it is similar.

@DaveInOhio
What errors if any are you getting, its most likely a simple fix of Wprogram.h to Arduino.h type of deal.
Check the LiquidCrystal.h file and see if it says WProgram.h, if it does change it to Arduino.h and save it. You may need to restart the Arduino software.
25  Using Arduino / Project Guidance / Re: Keypad and LCD help on: April 08, 2014, 12:44:20 pm
Use two global variables, currentTemp and currentVolume. When you enter a value on the keypad, you then update the global variable.
26  Using Arduino / Project Guidance / Re: trying to connect 5 8x8 matrixes only 4 work.the first 1 from left does not. on: April 08, 2014, 12:39:32 pm
The thing is, there is no reason for the forth display not working. Disconnect the first display, now see if all 4 come on. Post a picture or video of your setup.
27  Using Arduino / Project Guidance / Re: Keypad and LCD help on: April 08, 2014, 11:58:45 am
Yes it's possible but what are those variables supposed to do? And are you looking to keep them later in the sketch or every time you turn on the arduino?
28  Using Arduino / Programming Questions / Re: Question about Scroll Display Left on: April 08, 2014, 07:42:54 am
I modified it a little bit and add comments. I don't know exactly what your trying to do, but if you want two rows to shift at the same time (or different times) in opposite directions, then this is what you need.

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

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

char MessageOut[21];
char MessageOut2[21];
 
int index = 19, index2 = 0;
unsigned long oldTime = 0, oldTime2 = 0;

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

void loop()
{
  setHeadingRight("Hello", 0, 1000); // message, row, duration (1 second)
  setHeadingLeft("Welcome", 1, 500); // message, row, duration (half second)
}

void setHeadingRight(char * msg, byte row, unsigned long duration)
{
  strncpy(MessageOut, msg, sizeof(MessageOut));
  if(millis() - oldTime > duration) // check the difference of the current time "millis()" to the previous time "oldTime" against the duration you want.
  {
    oldTime = millis(); // update oldTime with the current time
    if(index >= 0) // make sure the index does not go under 0
    {
      index--; // decrecment index by 1
      for (int i = 0; i < N_CHARS; i++) // this part here displays the message on the display
      {
        lcd.setCursor(i,row); // set the column to show the element in the array
        if(index == N_CHARS) index = 0; // set index back to 0 if the index has reached the arrays max size.
       
        if(MessageOut[index++] != NULL) // if the element @ index is anything but NULL, show it.
          lcd.print(MessageOut[index-1]);
        else
          lcd.print(' '); // if the element @ index is NULL, display a space. 
      }
    }
    else index = 19; // if index is less than 0, then set it back to 19
  }
}

void setHeadingLeft(char * msg, byte row, unsigned long duration2)
{
  strncpy(MessageOut2, msg, sizeof(MessageOut2));
  if(millis() - oldTime2 > duration2)
  {
    oldTime2 = millis();
    if(index2 < 20) // check to see if index2 is under the array max size
    {
      index2++; // increment index
      for (int i = 0; i < N_CHARS2; i++) // same as above
      {
        lcd.setCursor(i,row);
        if(index2 == N_CHARS2) index2 = 0;
       
        if(MessageOut2[index2++] != NULL)
          lcd.print(MessageOut2[index2-1]);
        else
          lcd.print(' ');
      }
    }
    else index2 = 0; // otherwise set it back to 0
  }
}

29  Using Arduino / Project Guidance / Re: Keypad and LCD help on: April 07, 2014, 07:28:05 pm
You need to post your full code.
30  Using Arduino / Programming Questions / Re: Searching for info regarding the PS2X Library on: April 07, 2014, 05:00:25 pm
Check out this sketch I made for my robot.

Code:
#include <PS2X_lib.h>  //for v1.6

PS2X ps2x; // create PS2 Controller Class

int error = 0;
byte type = 0;
byte vibrate = 0;

byte speed1 =128, speed2 = 128;

byte M1L = 5;// PWM
byte M1R = 3;// PWM
byte M2L = 6;// PWM
byte M2R = 9;// PWM

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

  //**************PAY ATTENTION*************
  pinMode(M1L, OUTPUT);                                // Establishes LEDPin as an output so the LED can be seen
  pinMode(M1R, OUTPUT);
  pinMode(M2L, OUTPUT);                                // Establishes LEDPin as an output so the LED can be seen
  pinMode(M2R, OUTPUT);
  error = ps2x.config_gamepad(13,11,10,12, true, true);   //setup pins and settings:  GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error

  if(error == 0)
    Serial.println("Controller found! You may now send commands");

  else if(error == 1)
    Serial.println("No controller found, check wiring, see readme.txt to enable debug. visit www.billporter.info for troubleshooting tips");

  else if(error == 2)
    Serial.println("Controller found but not accepting commands. see readme.txt to enable debug. Visit www.billporter.info for troubleshooting tips");

  else if(error == 3)
    Serial.println("Controller refusing to enter Pressures mode, may not support it. ");

  type = ps2x.readType();
  switch(type)
  {
  case 0:
    Serial.println("Unknown Controller type");
    break;
  case 1:
    Serial.println("DualShock Controller Found");
    break;
  }
}

void loop()
{
  if(error == 1) //skip loop if no controller found
    return;
   
  else  //DualShock Controller
  {
    ps2x.read_gamepad(false, vibrate);          //read controller and set large motor to spin at 'vibrate' speed

    if(ps2x.Button(PSB_L1))//open claw manual
    {
      // rotate turret left
    }
    else if(ps2x.Button(PSB_R1))//close claw manual
    {
      // rotate turret right
    }
    else
    {
      // do nothing
    }

    // My sketch is designed to use both joysticks, Left joystick controls the left motor and right joystick does the right motor.
   // I can condense these two into just one IF / ELSE IF / ELSE statement, but here I separated them to show how one joystick controls its motor.
    if(ps2x.Analog(PSS_LY) >= 136 && ps2x.Analog(PSS_LY) <= 255)//real center value is 128, but 140 is needed because controller is HIGHLY sensitive
    {
      speed1 = map(ps2x.Analog(PSS_LY),136 , 255, 0 , 255);
      analogWrite(M1L, speed1);
      digitalWrite(M1R, LOW);
    }
    else if(ps2x.Analog(PSS_LY) >= 0 && ps2x.Analog(PSS_LY) <= 120) //Same as above
    {
      speed1 = map(ps2x.Analog(PSS_LY),0 ,120 , 255 , 0);// create a set range for values and set output values respectively
      digitalWrite(M1L, LOW);
      analogWrite(M1R, speed1);
    } 
    else {
      digitalWrite(M1L, LOW);// all off
      digitalWrite(M1R, LOW);
    }
    //--------------------Right side motor-----------------------   
    if(ps2x.Analog(PSS_RY) >= 136 && ps2x.Analog(PSS_RY) <= 255)
    {
      speed2 = map(ps2x.Analog(PSS_RY),136 , 255, 0 , 255);
      analogWrite(M2L, speed2);
      digitalWrite(M2R, LOW);
    }

    else if(ps2x.Analog(PSS_RY) >= 0 && ps2x.Analog(PSS_RY) <= 120)
    {
      speed2 = map(ps2x.Analog(PSS_RY),0 ,120 , 255 , 0);
      digitalWrite(M2L, LOW);
      analogWrite(M2R, speed2);
    }

    else
    {
      digitalWrite(M2L, LOW);
      digitalWrite(M2R, LOW);
    } 
  }
  delay(50); // not needed, but give the robot some time to finish inputted commands   
}

Pages: 1 [2] 3 4 ... 196