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 / 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;
@psychemist
psychemist / color-mixing-lamp.cpp
Created November 26, 2025 14:51
Arduino Starter Project 4
// set up constants for input and output pins
const int redLEDPin = 9;
const int greenLEDPin = 10;
const int blueLEDPin = 11;
const int redSensorPin = A0;
const int greenSensorPin = A1;
const int blueSensorPin = A2;
// add variables for incoming sensor and output values
@psychemist
psychemist / love-o-meter.cpp
Last active November 26, 2025 13:30
Arduino Starter Project 3
// declare global constant variables
const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup() {
// open a serial port connection between the Arduino board and computer
// allowing communication at 9600 bauds (bits per second)
Serial.begin(9600);
// assign digital pins as output and toggle off