Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Raspberry Pi / A few teething problems.

Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Nov 2016 21:21
I'm trying out my "Fruit Machine" and having a few problems.

Firstly, I have written a simple switch and LED program, and proved that I can interact with AGK.

I now have a circuit of 4 lighting buttons. Thus I have 4 inputs (switches) and 4 outputs (LEDs)
I have tested my circuit without the rPI and all works well. The buttons do what they should, and the LEDs light up.

The LEDs are triggered with a transistor. I apply a small current to the base, and the 12Volt LEDs are lit by a more powerful circuit. This works when I apply 9 volts to the base via a 1K resistor to manage the current. The transistors work on the usual 0.6V, saturated at 0.85V.

Problem 1 - Switches
The switches are floating until pressed...

GPIO2 - 1
GPIO3 - 1
GPIO4 - 1
GPIO17 - 0

It is possible to pull the GPIO pins up or down internally using code. But this is not possible in AGK. I will fix this with 10K pull-down resistors (when they arrive)

When I press the switches and pull them to (rPI) ground...

GPIO2 - no effect, stays at 1
GPIO3 - no effect, stays at 1

GPIO4 - Changes to 0
GPIO17 - N/A, already at zero.

I have checked with a voltmeter, and the pins are going to zero as expected. But AppGameKit does not register the change on 2 of them.

[EDIT] I found this snippet n a forum which may help me, I will test again at the weekend...
Quote: "Just as a point of interest, the reason your three LEDs are on at start up is probably because five of the 17 available GPIO lines are pulled high by default (the rest are pulled low). The numbers are GPIO0/2, GPIO1/3, GPIO4, GPIO7 and GPIO8. I'm not familiar with Wiring Pi pin numbers but I expect you'll find your pins match up with some of those GPIOs."


Problem 2 - LEDs
The LEDs simply don't work. I have code that "flashes" the LEDs by writing 0 and 1 to the GPIO pins. With the voltmeter I can see that the voltage is changing from 0 to 3.3 and back again. But the LEDs don't light. This must be an rPI issue, AppGameKit is behaving as expected.
Immediately after running the code I tested again with a higher voltage and it worked fine. But 3.3 V is more than adequate, and other rPI circuit designs I have seen use the same transistor.

Any additional input much apprecuiated!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2017-03-27 02:53:09
Your offset time is: 2017-03-27 02:53:09