led control

Humanoid's picture

This looks cool. I'd like to try it.

Hi,

I'd really like to try something like what you've done here. I've got a few questions as I'm new to all this.

Are you running two Megas plugged into two ports on your computer (left and right port)?

Are you using two colour changing LEDs or a number of different coloured ones on each side attached to individual pins?

Was that script run on Python in MRL?

 

moz4r's picture

Hi ! I use 2 mega ( 1 left

Hi ! I use 2 mega ( 1 left part of robot and head , 1 right part and lights and stufs )

I use 2 RGB led ( 4 pins > 1 ground / red / green / blue ) : pin GROUND/22/24/26

if you want pink just light 22+26

here the script : https://github.com/moz4r/pyrobotlab/blob/64218c34c609eab76303cf6ea77d75a...

Humanoid's picture

What about anodes?

I've got one of those little board ones with a single RGB on it. The outputs on it are RGB and V so I guess it's anode-doesn't have a ground output. Do you still have to ground anode ones or can they go straight into the Arduino?

Actually I think I've found the answer. I still need resistors and the voltage goes into the 5V with no ground. 

In the code LOW switches on and HIGH switches off (current sinking-opposite of cathode).

P.S. Your inMoov looks a little bit Batman.

Have you got a bread-board inside his head with your resistors in it?

moz4r's picture

yeh i have same problem /

yeh i have same problem / same rgb ( mine are 5V rgb )

so i do : 5V to common 5V

R/G/B ( LOW to switch ON / HIGH to switch off )

later I do

5V to digital pin like R/G/B to give some dimmable ligh with analogWrite comand.

 

I take this element from my son's Macdo toy ( sorry for him lol )

Humanoid's picture

It's worky!

Got it working now. 

I've learned some things from this little project.  

Thanks heaps, Moz!

Humanoid's picture

It's worky!

Got it working now. 

I've learned some things from this little project.  

Thanks heaps, Moz!

Humanoid's picture

Help adding rotating head

Hi, 
Now that I've got your program worky with some personal touches I'd like to add some head rotation movement as well.  The tab for rothead automatically opens with your program so I connected to the correct pin for the inMoov service (Pin13 in the left Arduino). I have tested the servo in the pin and it's worky.  I can tell that it's connecting to the Arduino and is ready to work.
 
I have added this script to the program to get a head movement test: 
 
i01.head.rothead.setMinMax(45, 120)
i01.head.rothead.setRest(90)
i01.head.rothead.setSpeed(0.80)
 
left.publishState()   #I've tried removing this line but no worky
i01.head.rothead.moveTo(120, 40, 92)  #I've also tried just using one number here but no worky 
sleep(2)
 
Unfortunately when I run the program it stops when it gets to this script. As soon as I remove it, the program works normally.  I don't think it's a power issue. 
 
Can you see what I'm doing wrong here?