Using sensors via Python


#1

Hello,

I am trying to program my robot using Python (not Scratch), but I can’t figure out the functions to control the (Grove) light and sound sensors. I found this link: http://www.dexterindustries.com/GoPiGo/programming/python-programming-for-the-raspberry-pi-gopigo/

But that list doesn’t contain those sensors. I can make everything work except those two sensors. I have no idea what functions they are looking for.

I bought the “GoBox” package through kickstarter, in case that helps with what accessories I have.

FYI, I’m self-learning Python right now, and thought this would be a fun way to get a broader range of projects. Apologies if this is a stupid question.

Thanks,
dragonsfiresoul


#2

Hello Dragonsfiresoul

Those sensors are simple analog sensors, and you would read them using gopigo.analogRead(15) where 15 is the analog port> I don’t have a Gopigo nearby to double check the code, but I’m fairly certain that’s it.
gopigo.analogRead(15)