Skip to content

Instantly share code, notes, and snippets.

@cmoz
cmoz / SoundClapBasic
Created March 23, 2022 14:23
Basic sound sensor with clap detection
#define sensorPin 7
// Variable to store the time when last event happened
unsigned long lastEvent = 0;
void setup() {
pinMode(sensorPin, INPUT); // Set sensor pin as an INPUT
Serial.begin(9600);
}
/*
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: https://arduinogetstarted.com/tutorials/arduino-button-long-press-short-press
*/
// constants won't change. They're used here to set pin numbers:
const int BUTTON_PIN = 7; // the number of the pushbutton pin
@cmoz
cmoz / ServoMoverToMeasureTouch
Created March 23, 2022 14:19
Servo moves to a touch input, via Andrew Quitmeyer
/*
This is an extension of Martin2250's ADC touch examples
to have the library built in, for rapid deployment in workshop settings
In this one, you can hook a servo directly up and the servo will move with regard to the cap touch measurement
*/
#include "ADCTouch.h"
@cmoz
cmoz / TouchWiggleServo
Created March 23, 2022 14:17
Touch Wiggle Servo example via Andrew Quitmeyer
/*
This is an extension of Martin2250's ADC touch examples
to have the library built in, for rapid deployment in workshop settings
In this one, you can hook a servo directly up
and if the sensor passes a threshold, the servo will wiggle around
*/
#include "ADCTouch.h"
@cmoz
cmoz / TouchServo
Created March 23, 2022 14:16
touch servo example via Andrew Quitmeyer
/*
This is an extension of Martin2250's ADC touch examples
to have the library built in, for rapid deployment in workshop settings
In this one, you can hook a servo directly up
and if the sensor passes a threshold, the servo will flip to 180
*/
#include "ADCTouch.h"
@cmoz
cmoz / ColSenseNeoOLED
Created March 23, 2022 14:11
Colour Sensor with NeoPixels and OLED
#include <Wire.h> //include Wire.h to be able to communicate through I2C on Arduino board
#include "Adafruit_TCS34725.h" //Colour sensor library
#include "Adafruit_GFX.h"
#include "Adafruit_SSD1306.h"
#include "Adafruit_NeoPixel.h"
//Create colour sensor object declaration, to see effects of different integration time and gain
//settings, check the datatsheet of the Adafruit TCS34725.
Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_50MS, TCS34725_GAIN_4X);
#include <Adafruit_CircuitPlayground.h>
uint8_t pixeln = 0;
int capsense[10];
void setup() {
CircuitPlayground.begin();
}
void loop() {
@cmoz
cmoz / SonicNeoDistanceHat
Last active March 31, 2022 17:32
Entire code for distance hat
/**************************************************
* Ultrasonic Distance Sensor Hat with NeoPixels, vibration motor and buzzer
* based on HC-SR04 sonar sensor, NeoPixel libraries
* Author: Christine Farion
* Site: www.christinefarion.com
* Twitter: @cmoz
* Date: October 2021
* License: CC BY-NC-SAi
*
* using Adafruit NeoPixel Library
@cmoz
cmoz / SampleNeo
Created March 23, 2022 14:03
SampleNeoPixel
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// Released under the GPLv3 license to match the rest of the
// Adafruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
// Which pin on the Arduino is connected to the NeoPixels?
@cmoz
cmoz / ultraSonic.txt
Last active March 23, 2022 14:03
Ultrasonic Sensor
#include <HCSR04.h>
UltraSonicDistanceSensor distanceSensor(13, 12); // Initialize sensor that uses digital pins 13 and 12.
void setup () {
Serial.begin(9600); // We initialize serial connection so that we could print values from sensor.
}
void loop () {
// Every 500 miliseconds, do a measurement using the sensor and print the distance in centimeters.