I need help in the code please

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

I need help in the code please

Postby SEMA » Mon Apr 23, 2012 1:45 am

Hi,
I have created this code to make the servo press to camera to take a picture each X min and i add to my circle 2 pushbuttons. I need to add LCD but i have no idea how can i add it to my code to count and read the picture and time.. can some one help me on it please!

#include <Servo.h>

Servo myservo; // create servo object to control a servo

int pos = 0; // variable to store the servo position
const int buttonPin = 2; //sets pin 2 as button
const int buttonPin2 = 3; //sets pin 3 as button
const int ledPin = 13; // sets pin 13 as LED for testing purposes
int buttonState = 0; //sets button 1 as off
int buttonState2 = 0; // sets button 2 as off

void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode (buttonPin, INPUT); // sets button as input
pinMode (ledPin, OUTPUT); // sets led as output
myservo.write(90); // starts servo at 90 degrees
}

void loop()
{
buttonState = digitalRead(buttonPin);
buttonState2 = digitalRead(buttonPin2);

if (buttonState == HIGH)
{
digitalWrite(ledPin, HIGH);
for(pos = 90; pos < 110; pos += 1) // goes from 90 degrees to 110 degrees

{ // in steps of 1 degree

myservo.write(pos); // tell servo to go to position in variable ‘pos’

delay(15); // waits 15ms for the servo to reach the position

}

delay (1500);

for(pos = 110; pos>=90; pos-=1) // goes from 110 degrees to 90 degrees
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}
else {
digitalWrite(ledPin, LOW);
}

if (buttonState2 == HIGH)
{

digitalWrite(ledPin, HIGH);
for(pos = 90; pos >=70; pos -= 1) // goes from 90 degrees to 70 degrees in steps of 1 degree
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
delay (1500);
for(pos = 70; pos <=90; pos+=1) // goes from 70 degrees to 90 degrees
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}
else {
digitalWrite(ledPin, LOW);
}
}
SEMA
 
Posts: 4
Joined: Mon Apr 23, 2012 1:33 am

Re: I need help in the code please

Postby adafruit_support_bill » Mon Apr 23, 2012 5:41 am

I need to add LCD but i have no idea how can i add it to my code to count and read the picture and time.

First you need to decide what kind of LCD. There are many to choose from: http://www.adafruit.com/category/63

The character LCDs are simpler to work with than the graphical ones.
The easiest of all is the LCD shield.
User avatar
adafruit_support_bill
 
Posts: 16042
Joined: Sat Feb 07, 2009 9:11 am

Re: I need help in the code please

Postby SEMA » Mon Apr 23, 2012 1:32 pm

Hi,

Here The link for the LCD which I have.

http://www.sparkfun.com/products/10768

Please help me!
SEMA
 
Posts: 4
Joined: Mon Apr 23, 2012 1:33 am

Re: I need help in the code please

Postby franklin97355 » Mon Apr 23, 2012 2:54 pm

Have you tried the SparkFun site for help? They should support that display. It looks like the have something on github
User avatar
franklin97355
 
Posts: 1706
Joined: Mon Apr 21, 2008 1:33 pm

Re: I need help in the code please

Postby SEMA » Mon Apr 23, 2012 3:26 pm

No I did not.
Because my problem only in the code! I have not a strong background in programing. my code is work but I need to add this object.
SEMA
 
Posts: 4
Joined: Mon Apr 23, 2012 1:33 am

Re: I need help in the code please

Postby adafruit_support_bill » Mon Apr 23, 2012 4:14 pm

Our libraries work with the displays we sell and we can offer support for those.
Sparkfun has a support forum too and they should be able to help you with the display you bought from them.
User avatar
adafruit_support_bill
 
Posts: 16042
Joined: Sat Feb 07, 2009 9:11 am

Re: I need help in the code please

Postby SEMA » Mon Apr 23, 2012 10:29 pm

Ok thanks.
SEMA
 
Posts: 4
Joined: Mon Apr 23, 2012 1:33 am


Return to Arduino

Who is online

Users browsing this forum: No registered users and 10 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [103]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[61]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]