Skip to content

Integrate WiringPi - Speed Class #183

@shahdivyank

Description

@shahdivyank
  • 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 as flash() (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_variables as an integer

Implementation:

  1. You will need to add a pinMode() to the setup() function of the said class
  2. 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!

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions