Skip to content

Instantly share code, notes, and snippets.

@cmoz
cmoz / BlinkESP32.ino
Created Apr 10, 2022
Blink with generic ESP32 board
View BlinkESP32.ino
const int ledPin = 2; // User LED is connected to Pin 2
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(ledPin, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
@cmoz
cmoz / C6_6.5TouchTogether
Created Mar 30, 2022
Touch together, a socially playable instrument
View C6_6.5TouchTogether
#include <Adafruit_CircuitPlayground.h>
uint8_t pixeln = 0;
int capsense[10];
void setup() {
CircuitPlayground.begin();
for(int i=0; i< CircuitPlayground.strip.numPixels(); i++) {
CircuitPlayground.setPixelColor(i, ( 0, 0, 255));
CircuitPlayground.strip.show();
View C6_6.1HandHexCol
#include <Wire.h>
#include "Adafruit_TCS34725.h"
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
void setup() {
Serial.begin(9600);
Serial.println("Color View Test!");
if (tcs.begin()) {
Serial.println("Found sensor");
} else {
View C5_5.6TouchNature
#include "ADCTouch.h"
#include <Servo.h>
Servo myservo;
int ref0;
int touchPin1 = A7;
int val0constrained = 0;
View C5_5.4Sound
#define sensorPin 7
int ledPin = 2;
unsigned long lastEvent = 0;
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
View C5_5.3Stretch
#define MYRESISTOR 10000
#define STRETCHPIN A0
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
float reading;
View C5_5.1UltrasonicGemma
int trigPin = A0;
int echoPin = A1;
long duration, cm, inches;
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
View C4_4.6GemmaFlexServo
#include <Servo.h>
Servo servo1;
int flexpin = A0;
void setup()
{
Serial.begin(9600);
servo1.attach(A1);
}
View C4_4.5LEDFlex
int ledPin = 9;
int flexPin = 10;
int flexValue;
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(flexPin, INPUT);
Serial.begin(9600);
}
View C4_4.2HelloNeoPixels
#include <Adafruit_CircuitPlayground.h>
float X, Y, Z;
#define MOVE_THRESHOLD 3 //To 10, lower the number more sensitive
void setup() {
Serial.begin(9600);
CircuitPlayground.begin();
}