RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 1
Going crazy over Gpio....
Author Message
Reply with quote
Post Going crazy over Gpio.... 
So I have been trying to get my oil warning light working, and have been really struggling... No matter what I do, the Gpio seems to be in a state of 0.

So I finally simplified my code down to this:


Code:
function onTick()
   setGpio(0, 1)
   println("Oil Warn " ..getGpio(0))
 end


And still, all I see returned is:
Oil Warn 0.0

What am I doing wrong??? The channel is on, the sample rate is 1hz, and the mode is output....

Going crazy here!

View user's profile Send private message Visit poster's website
Reply with quote
Post  
You have no scripting for checking the oil pressure/temp it looks like. From the Wiki, you'd need something like this:

Code:
function onTick()
 if getAnalog(0) > 212 then
   setGpio(0, 1)
 else
   setGpio(0, 0)
 end
end


View user's profile Send private message
Reply with quote
Post  
I was attempting to eliminate excess steps, so instead of using logic to determine whether or not to set the Gpio to 0 or 1, I just go ahead and set it to 1.

It wasn't working with the logic, so I just set it as a constant.

View user's profile Send private message Visit poster's website
Reply with quote
Post  
So I think the problem goes deeper....

I have a race capture MK1, and I plugged that in and loaded that code. I get a return of 1 instead of 0 now....

View user's profile Send private message Visit poster's website
Reply with quote
Post  
For MK1, you have to set the GPIO to output mode via the internal jumpers, and set the configuration to 'output'.

When GPIO is activated (1) it connects the output to ground. You can test it by driving a relay where the ground side of the relay is powered via the GPIO.

Hope this helps!


_________________
Brent Picasso
Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum