Very nice tutorial. I've been wanting to get into programming for my RaspberryPi a and I am more comfortable with C than Python, so this is great. Also much better audio in this video than in your older videos. Nice job!
Do you know - if you CTRL-C to exit a running program and a GPIO pin is, say, HIGH, is there a chance the pin will be left in the HIGH state, or will it be set LOW on program exit? Just curious. Thx.
Good question different hardware can behave diffent. With control C you call the INThandler function. To make sure your GPIO pins are all LOW you can override this funtion something like this: void INThandler(int sig) { printf("set all pins LOW " "with this for loop "); for(int pin =0; pin < numberOfPins; i++) { //set pin LOW digitalWrite(pin, LOW); } } stackoverflow.com/questions/4217037/catch-ctrl-c-in-c