-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
- Documentation for WiringPi
- Currently, the only way to trigger the event is to press on the virtual button, which is not ideal
- We also want to consider external inputs, hence the integration of WiringPi is needed to control the GPIO (General Purpose Input/Output)
- Inside the
gather_data()function previously known asflash()(this is another issue that we need to do) we want to get input from the GPIO and based off of that information, trigger the appropriate function - Given this is a nonbinary event, we will be reading the integer value returned and use that
- In terms of the GPIO pin to use, assume that value will come from the
global_variablesas an integer
Implementation:
- You will need to add a
pinMode()to thesetup()function of the said class - You will need to read in the value at the said pin in the
gather_data()function and trigger the appropriate function within the class
For now, we will not worry about writing any values to the GPIO (we may need to later on?!), depends on how it will be electrically connected. For now, we will be strictly reading from GPIO only!
Below is an example of how to blink an LED with wiringPI (notice it takes direct influence on the Arduino syntax):
#include <wiringPi.h>
int main (void)
{
wiringPiSetup();
pinMode (0, OUTPUT) ;
for (;;)
{
digitalWrite (0, HIGH) ; delay (500) ;
digitalWrite (0, LOW) ; delay (500) ;
}
return 0 ;
}Hence this means, you can use digitalRead(PIN_NUMBER); to gather information!