Society of Robots - Robot Forum
|
Robot Tutorials
|
FAQ
|
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Squirrels have fuzzy tails.
Home
Help
Search
Login
Register
Society of Robots - Robot Forum
»
Software
»
Software
»
LED CODE Please help
Print
Author
Topic: LED CODE Please help (Read 2459 times)
0 Members and 1 Guest are viewing this topic.
robotmaniac
Jr. Member
Posts: 40
Helpful? 0
LED CODE Please help
«
on:
November 06, 2012, 04:25:43 PM »
Could some on tell me what is worng with this code?
#include <avr/io.h>
int main(void)
/*0d004321ba*/
{
DDRD = 0D00000001;//Setting port 0 to oput
PORTD = 0D00000001;//setting port 0 high
while(1){}
}
cause i get this
../LED_matrix_v1.c:5:9: error: invalid suffix "D00000010" on integer constant
../LED_matrix_v1.c:6:11: error: invalid suffix "D00000010" on integer constant
Im just trying to light up 8 LEDs using multiplexing but i want to turn on only
port PD0
isnt that the way??
Logged
Learning from what I can...
jkerns
Robot Overlord
Posts: 270
Helpful? 12
Re: LED CODE Please help
«
Reply #1 on:
November 06, 2012, 04:34:40 PM »
0D? not 0b?
What compilier are you using?
Logged
I get paid to play with robots - can't beat that with a stick.
http://www.ltu.edu/engineering/mechanical/bachelor-science-robotics-engineering.asp
robotmaniac
Jr. Member
Posts: 40
Helpful? 0
Re: LED CODE Please help
«
Reply #2 on:
November 06, 2012, 04:49:06 PM »
Im using AVR but I wanted to turn on the portD for the ATmega 8
Logged
Learning from what I can...
stridera
Jr. Member
Posts: 28
Helpful? 0
Software Engineer, Author, Hacker.
Re: LED CODE Please help
«
Reply #3 on:
November 06, 2012, 07:35:28 PM »
You definitely want to use B not D. B for Binary.
B00000001
Refer to this:
http://www.arduino.cc/en/Reference/IntegerConstants
Logged
robotmaniac
Jr. Member
Posts: 40
Helpful? 0
Re: LED CODE Please help
«
Reply #4 on:
November 06, 2012, 07:48:58 PM »
oo thaks now how can i creat a patern?
Logged
Learning from what I can...
stridera
Jr. Member
Posts: 28
Helpful? 0
Software Engineer, Author, Hacker.
Re: LED CODE Please help
«
Reply #5 on:
November 06, 2012, 08:57:49 PM »
If you want to send data serially, you'll need a serial converter. This will take 1-2 pins from the arduino and translate that to x pins, depending on the converter. (2 pins for a lock.) (Plenty of information on how to do this across the web.)
Logged
jkerns
Robot Overlord
Posts: 270
Helpful? 12
Re: LED CODE Please help
«
Reply #6 on:
November 07, 2012, 10:08:34 AM »
This guy:
http://newbiehack.com/MicrocontrollerTutorial.aspx
does a decent job of walking you through turning on an LED, making it blink, playing games with it, etc. in a step by step process.
Logged
I get paid to play with robots - can't beat that with a stick.
http://www.ltu.edu/engineering/mechanical/bachelor-science-robotics-engineering.asp
robotmaniac
Jr. Member
Posts: 40
Helpful? 0
Re: LED CODE Please help
«
Reply #7 on:
November 11, 2012, 08:32:06 PM »
thanks guys but when I turn all the leds the last one stays off. I created an 2x4 but when I turn only that one it turns one.
Logged
Learning from what I can...
stridera
Jr. Member
Posts: 28
Helpful? 0
Software Engineer, Author, Hacker.
Re: LED CODE Please help
«
Reply #8 on:
November 11, 2012, 08:34:10 PM »
If you're using pins on the Arduino, make sure you're not using the TX/RX pins. (They're for the serial connection and if you have it connected to the computer to power it, they'll always be on.
Logged
Print
Society of Robots - Robot Forum
»
Software
»
Software
»
LED CODE Please help