diff examples/02-Digital/digital-input/render.cpp @ 543:8f8809c77dda prerelease

updated basics, digital, instruments, extras examples
author chnrx <chris.heinrichs@gmail.com>
date Fri, 24 Jun 2016 13:19:52 +0100
parents 1cec96845a23
children
line wrap: on
line diff
--- a/examples/02-Digital/digital-input/render.cpp	Fri Jun 24 13:00:31 2016 +0100
+++ b/examples/02-Digital/digital-input/render.cpp	Fri Jun 24 13:19:52 2016 +0100
@@ -42,7 +42,7 @@
 		int status=digitalRead(context, 0, P8_08); //read the value of the button
 		digitalWriteOnce(context, n, P8_07, status); //write the status to the LED
 		float out = 0.1 * status * rand() / (float)RAND_MAX * 2 - 1; //generate some noise, gated by the button
-		for(unsigned int j = 0; j < context->audioChannels; j++){
+		for(unsigned int j = 0; j < context->audioOutChannels; j++){
 			audioWrite(context, n, j, out); //write the audio output
 		}
 	}
@@ -75,6 +75,8 @@
 P8_07 is set to `HIGH` as well, so that the LED conducts and emits light. When 
 the button is pressed, P8_08 goes `LOW` and P8_07 is set to `LOW`, turning off the LED.
 
+Note that there are two ways of specifying the digital pin: using the GPIO label (e.g. `P8_07`), or using the digital IO index (e.g. 0)
+
 As an exercise try and change the code so that the LED only turns on when 
 the button is pressed.
 */