Skip to content

Instantly share code, notes, and snippets.

@cmoz
cmoz / Main.java
Created February 22, 2024 21:52
First example with linkedList and a Product object
import java.util.LinkedList;
// our product class that we created to create a product
class Product {
private String name;
private double price;
private String description;
// Getters and setters for product properties
@cmoz
cmoz / Main2.java
Created February 22, 2024 21:50
LinkedList example and overriding the toString() method
import java.util.LinkedList;
class ProductItem {
private int productId;
private String productName;
public ProductItem(int productId, String productName) {
this.productId = productId;
this.productName = productName;
}
#include "ADCTouch.h"
#include <Servo.h>
Servo myservo;
int ref0;
int touchPin1 = A7;
int val0constrained = 0;
@cmoz
cmoz / BlinkESP32.ino
Created April 10, 2022 13:55
Blink with generic ESP32 board
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 / 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 / C6_6.5TouchTogether
Created March 30, 2022 13:08
Touch together, a socially playable instrument
#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();
#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 {
#include <Adafruit_CircuitPlayground.h>
uint8_t pixeln = 0;
int capsense[10];
void setup() {
CircuitPlayground.begin();
}
void loop() {
#define sensorPin 7
int ledPin = 2;
unsigned long lastEvent = 0;
void setup() {
pinMode(sensorPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
#define MYRESISTOR 10000
#define STRETCHPIN A0
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
float reading;