Skip to content

Instantly share code, notes, and snippets.

View futureshocked's full-sized avatar

Peter Dalmaris futureshocked

View GitHub Profile
@futureshocked
futureshocked / sensor.ino
Created September 4, 2019 03:05
One of Peter's sketches in which he uses JSON to send data to Adafruit IO and receive, parse the response using ArduinoJSON.
void refresh_readings() {
float f_temperature;
float f_humidity;
float f_pressure;
float f_altitude;
digitalWrite(LED_PIN, HIGH);
postCounter++; // New post, increase the post counter
@futureshocked
futureshocked / 05_button_reaction.ino
Created October 1, 2019 04:27
05. Arduino button oscilloscope demo sketch (Oscilloscopes for Busy People)
/* 05. Arduino button oscilloscope demo sketch
*
* Use this sketch to see a button press as a waveform event in the
* oscilloscope.
*
* Connect CHA of the oscilloscope to the button signal pin.
*
* Connect CHB to the anode of an LED.
*
* Set the scope to 5us time scale and 200mV voltage scale.
@futureshocked
futureshocked / 06_distance_sensor.ino
Created October 1, 2019 04:50
06. Ultrasonic distance sensor HC-SR04 demo sketch (Oscilloscopes for Busy People)
/* 06. Ultrasonic distance sensor HC-SR04 demo sketch
*
* This sketch calculates the distance between the HC-SR04 sensor and
* an object directly infront of it.
*
* To see the trigger and echo waveforms with your oscilloscope,
* connect CHA to the trigger and CHB to the echo pins.
*
* Set up edge trigger to CHA, and set it to 1V (or there about).
*
@futureshocked
futureshocked / 07_PWM.ino
Created October 1, 2019 04:53
07. Arduino PWM oscilloscope demo sketch (Oscilloscopes for Busy People)
/* 07. Arduino PWM oscilloscope demo sketch
*
* Use this sketch to experiment with the measurement of a PWM waveform
* on an oscilloscope.
*
* Connect CHA of the oscilloscope to the anode of the LED.
*
* Use a potentiometer to control the duty cycle.
*
* Set triggering to Auto, and start the experiment.
@futureshocked
futureshocked / 08_servo_control.ino
Created October 1, 2019 05:14
08. Arduino servo control oscilloscope demo sketch (Oscilloscopes for Busy People)
/* 08. Arduino servo control oscilloscope demo sketch
*
* Use this sketch to experiment with the measurement of a PWM waveform
* used to control a servo motor on an oscilloscope.
*
* Connect CH1 of the oscilloscope to pin 9 that controls the servo.
*
* Use a potentiometer to control the duty cycle and therefore the position of the
* servo.
*
@futureshocked
futureshocked / main.cpp
Last active August 22, 2024 01:07
09_ESP32 Signal generator (Oscilloscopes for Busy People)
// With this program, you can use the ESP32 as an ultra-low cost signal generator.
// To learn more, see https://techexplorations.com/courses/oscilloscopes/
#include <Arduino.h>
#include "waveforms.h"
int i = 0;
int sample_delay = 0;
const byte POT_GPIO = 35; // Potentiometer
int t_sample;
@futureshocked
futureshocked / 10_1_UART_RX_Counter.ino
Last active October 1, 2019 06:03
10.1. Arduino UART receive integer oscilloscope demo sketch (Oscilloscopes for Busy People)
/* 11.1. Arduino UART receive integer oscilloscope demo sketch
*
* Use this sketch to experiment with the decoding of a single
* integer in simplex on an oscilloscope.
*
* Connect CH1 of the oscilloscope to pin 0 of the Arduino.
* Connect CH2 of the oscilloscope to pin 1 of the Arduino.
*
*
* This sketch was written for Oscilloscopes for Busy People by Peter Dalmaris.
@futureshocked
futureshocked / 10_1_UART_RX_Counter.ino
Last active October 14, 2019 19:38
10.2. Arduino UART receive/transmit ASCII character and decode with an oscilloscope demo sketch (Oscilloscopes for Busy People)
/* 11.2. Arduino UART receive/transmit ASCII character and decode with an oscilloscope demo sketch
*
* Use this sketch to experiment with the decoding of an ASCII character
* that is received and transmitted by an Arduino on an oscilloscope.
*
* Use in tandem with the matching Processing sketch
*
* Connect CH1 of the oscilloscope to pin 0 of the Arduino.
* Connect CH2 of the oscilloscope to pin 1 of the Arduino.
*
@futureshocked
futureshocked / 10_3_Decode_UART_packet.ino
Last active October 1, 2019 06:02
10.3. Arduino UART receive/transmit a packet and decode with an oscilloscope demo sketch (Oscilloscopes for Busy People)
/* 11.3. Arduino UART receive/transmit a packet and decode with an oscilloscope demo sketch
*
* Use this sketch to experiment with the decoding of a multi-byte packet
* that is received and transmitted by an Arduino on an oscilloscope.
*
* Use in tandem with the matching Processing sketch
*
* Connect CH1 of the oscilloscope to pin 0 of the Arduino.
* Connect CH2 of the oscilloscope to pin 1 of the Arduino.
*
@futureshocked
futureshocked / 11_decode_I2C_BME280.ino
Last active October 1, 2019 06:08
11. Arduino with BME280 I2C example sketch (Oscilloscopes for Busy People)
/* 11. Arduino with BME280 I2C example sketch
*
* Use this sketch to experiment with the decoding of I2C communication on an oscilloscope.
*
* Connect CH1 of the oscilloscope to SCL.
* Connect CH2 of the oscilloscope to SDA.
*
*
* This sketch was written for Oscilloscopes for Busy People by Peter Dalmaris.
* Find out more at https://techexplorations.com/courses/oscilloscopes/