Skip to content

Instantly share code, notes, and snippets.

View psychemist's full-sized avatar
👽
getting cracked

DIKE psychemist

👽
getting cracked
View GitHub Profile
@psychemist
psychemist / tweak-logo.cpp
Last active December 24, 2025 11:21
Arduino Starter Project 14
void setup() {
// open serial connection
Serial.begin(9600);
}
void loop() {
// send sensor value
Serial.write(analogRead(A0) / 4);
// let the ADC stabilize
@psychemist
psychemist / zoetrope.cpp
Created December 16, 2025 15:34
Arduino Starter Project 10
const int controlPin1 = 2;
const int controlPin2 = 3;
const int enablePin = 9;
const int directionSwitchPin = 4;
const int onOffSwitchStateSwitchPin = 5;
const int potentialPin = A0;
// create variables for recording program state
int onOffSwitchState = 0;
int previousOnOffSwitchState = 0;
@psychemist
psychemist / motorized-pinwheel.cpp
Created December 10, 2025 13:41
Arduino Starter Project 9
const int switchPin = 2;
const int motorPin = 9;
int switchState = 0;
void setup() {
// declare pins' directions
pinMode(switchPin, INPUT);
pinMode(motorPin, OUTPUT);
}
@psychemist
psychemist / touchy-feely.cpp
Last active December 10, 2025 13:12
Arduino Starter Project 13
#include <CapacitiveSensor.h>
CapacitiveSensor capSensor = CapacitiveSensor(4, 2);
// set up lamp capacitance threshold
int threshold = 400000;
const int ledPin = 12;
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
@psychemist
psychemist / knock-lock.cpp
Last active December 10, 2025 12:47
Arduino Starter Project 12
#include <Servo.h>
Servo myServo;
// constant variables for input and output components
const int piezo = A0;
const int switchPin = 2;
const int redLED = 3;
const int yellowLED = 4;
const int greenLED = 5;
@psychemist
psychemist / crystal-ball.cpp
Last active December 9, 2025 11:11
Arduino Starter 11
// set up LiquidCrystal library
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int switchPin = 6;
int switchState = 0;
int prevSwitchState = 0;
int response;
void setup() {
@psychemist
psychemist / hourglass.cpp
Last active December 8, 2025 12:24
Arduino Starter Project 8
const int switchPin = 8;
unsigned long int prevTime = 0;
long interval = 300000;
int switchState = 0;
int prevSwitchState = 0;
int nextLED = 2;
void setup() {
// set direction of digital pins
for( int x = 2; x < 8; x++ ) {
@psychemist
psychemist / keyboard.cpp
Last active December 5, 2025 15:30
Arduinnon Starter Project 7
// set up array of 6 integers representing frequencies
int notes[] = [ 262, 294, 330, 349];
void setup() {
// begin serial communnication
Serial.begin(9600);
}
void loop() {
// read analog value and send to serial monitor
@psychemist
psychemist / light-theremin.cpp
Last active December 5, 2025 15:27
Arduino Starter Project 6
// create variables for calibrating the sensor
int sensorValue;
int sensorLow = 1023;
int sensorHigh = 0;
// create constant for calibration indicator at on-board LED connected to pin 13
const int ledPin = 13;
void setup() {
// set digital pin direction and turn it high
@psychemist
psychemist / mood-servo.cpp
Last active December 5, 2025 13:44
Arduino Starter Project 5
// import Servo library
#include <Servo.h>
// create Servo object from library
Servo myServo;
// declare variables for potentiometer pin, analog input value and servo angle
int const potPin = A0;
int potVal;
int angle;