Physical Controllers

From Experimental Game Cultures
Revision as of 16:00, 1 June 2023 by Georg (talk | contribs)
Jump to navigation Jump to search

Hand holding sensor

Measure the voltage - could be a chain of humans that hold hands, Arduino measure the voltage and smoothes it out with a capacitor. The LED is just to show the difference in voltage:

The Arduino connects to 5Volts, Ground and Analog 0

The Arduino connects to 5Volts, Ground and Analog 0

The Breadboard, purple wires are for holding in your hands. Capacitor to smooth out the voltage.

The Breadboard, purple wires are for holding in your hands. Capacitor to smooth out the voltage.


The code

void setup() {

 // initialize serial communication at 9600 bits per second:
 Serial.begin(9600);
 pinMode(LED_BUILTIN, OUTPUT);

}


void loop() {

 // read the input on analog pin 0:
 int sensorValue = analogRead(A0);
 // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
 float voltage = sensorValue * (5.0 / 1023.0);
 // print out the value you read:
 Serial.println(voltage);
 digitalWrite(LED_BUILTIN, HIGH);
 delay(voltage * 10);
 digitalWrite(LED_BUILTIN, LOW);
 delay(voltage * 10);

}