Session 1a

[heading size=”1″ color=”#80D6F9″]The Code[/heading]

Let’s see what goes on inside the code. You can read about Circuit Touch (3), Key Press (19) and LED (5) on your Handout.

Mario Code[toggle active=”no” title=”Here is the Code”]

// include the Quirkbot library to your program:
#include “Quirkbot.h”

// create your Quirkbot nodes here:
CircuitTouch circuitTouch1;
CircuitTouch circuitTouch2;
CircuitTouch circuitTouch3;
CircuitTouch circuitTouch4;
KeyPress keyPress1;
KeyPress keyPress2;
KeyPress keyPress3;
KeyPress keyPress4;
Led led1;
Led led2;
Led led3;
Led led4;

// create your other Arduino variables and functions here:

void setup(){
// setup your Quirkbot nodes here: = H;
circuitTouch1.sensitivity = 0.63;
circuitTouch1.min = 0;
circuitTouch1.max = 1; = LA;
circuitTouch2.sensitivity = 0.49;
circuitTouch2.min = 0;
circuitTouch2.max = 1; = RA;
circuitTouch3.sensitivity = 0.6;
circuitTouch3.min = 0;
circuitTouch3.max = 1; = LL;
circuitTouch4.sensitivity = 0.75;
circuitTouch4.min = 0;
circuitTouch4.max = 1;

keyPress1.key = KEY_UP;

keyPress2.key = KEY_RIGHT;

keyPress3.key = KEY_LEFT;

keyPress4.key = KEY_S;

led1.light.connect(circuitTouch1.out); = H;

led2.light.connect(circuitTouch2.out); = LE;

led3.light.connect(circuitTouch3.out); = RE;

led4.light.connect(circuitTouch4.out); = LL;

// put your other Arduino setup code here, to run once:


void loop(){
// put your main Arduino code here, to run repeatedly:



[toggle active=”no” title=”What does it do?”]

The Circuit Touch activates when you touch the corresponding part of the Quirkbot. As soon as it detects your finger, it sends two signals. One to the LED (a light which turns on) and one to the Keystroke – in this case the three arrows and the space bar.



[button style=”medium” type=”rounded” color=”#COLOR_CODE” background=”#COLOR_CODE” src=”” target=”_blank”]NEXT[/button]