Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate WiringPi - Speed Class #183

Open
shahdivyank opened this issue Sep 5, 2022 · 0 comments
Open

Integrate WiringPi - Speed Class #183

shahdivyank opened this issue Sep 5, 2022 · 0 comments
Assignees

Comments

@shahdivyank
Copy link
Member

  • 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants