Hi! I\'m trying to implement a \"Steady Hands\" game using a Raspberry Pi for a
ID: 3574938 • Letter: H
Question
Hi!
I'm trying to implement a "Steady Hands" game using a Raspberry Pi for a Computer Engineering project. So far, I typed a set of if-else statements. I'm required to use the "C" language and must utilize the "wiringPi.h" library on the Raspberry Pi. I have tried to look online for any kind of guidance, but can only seem to pull up examples that use the "Python" language.
www.youtube.com/watch?v=eSwctRhhS2A <-- Here is a good idea of my desired goal.
This is my code so far...
I probably need a for/while loop and some scanf statements (maybe?)
Any kind of guidance is very much appreciated.
#includeExplanation / Answer
in place of
else end=5
{
printf("penalty+score");
}
you can use the below
int penality=0; //initialise the penality to 0
float time=0; //initialise time taken to 0
while(end!=5) //countinue the loop untill end reaches to 5
{
delay(500);
time=time+0.5;
if(wire==1) //if touches wire increment penality.
{
penality=penality+1;
wire=0;
}
}
printf("Penality : %d Total time : %f secs",penality,time); //print time and penality....
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.