Skip to content

Instantly share code, notes, and snippets.


Levi Lesches Levi-Lesches

View GitHub Profile
Levi-Lesches / nrf.ino
Last active Feb 20, 2020
Arduino NRF radio controls
View nrf.ino
This script is for one NRF to send data to the other. The NRF sending the data
called the server, and the device receiving the data is called the client.
The setup for both devices is the same, the looping is what's different.
Here is a pinout for both devices:
* CE --> 9
* CSN --> 10
* MOSI --> 11
Levi-Lesches / tutor.dart
Created Feb 4, 2020
RamLife Tutoring data types
View tutor.dart
enum Subject {history, english} // ...
enum Reviewer {teacher, student}
class User {
String first, last;
int rating;
class Tutor extends User {
int yearGraduated;
Levi-Lesches / car_drive.ino
Created Jan 3, 2020
A sketch to control an H-Bridge
View car_drive.ino
// These "#define" statements are *like* variables, but not really
// Variables can be changed to any other value, but these cannot
// They don't even stay in memory! What happens is, when you press compile,
// the Arduino replaces all the times the name comes up in the code with the
// value before sending it to the Arduino board. So it's not really a variable
// you can control, but rather just another name for a value.
// The define statement looks like this: #define NAME VALUE. Note that NAME can
// not contain spaces, because then it would be interpreted as VALUE.
Levi-Lesches / Sensor.ino
Last active Feb 20, 2020
Arduino Ultrasonic sensor
View Sensor.ino
#define echo 2
#define trigger A0
#define threshold 6
long getDistance() {
// This function returns the distance of an object from the sensor in cm
// An ultrasonic sensor sends a sound wave pulse outwards, and then waits for it to hit an
// object and bounce back to the sensor.
Levi-Lesches / Stocks.dart
Last active Feb 20, 2020
Simple stock market code
View Stocks.dart
class Range {
final num buy, sell;
const Range(, this.sell);
Range maxProfit(List<double> points) {
// We want to find a range by examining a list of local minima and maxima
// We can assign a new list (think about what type it would hold) of those minima and maxima
// To find that list, we go through the list of points, two at a time, watching
// for changes in whether the points are increasing or decreasing.
Levi-Lesches / lost_and_found.dart
Last active Feb 20, 2020
Lost and Found page
View lost_and_found.dart
import "package:flutter_web/material.dart";
import "package:flutter_web/cupertino.dart";
import "package:flutter_web_ui/ui.dart" as ui;
// Lines like these are comments (only read by people, ignored by computer)
/// Lines like these (three slashes) explain only the class/function/variable right underneath them
// Any part of a comment in [brackets] are either defined here in this file or
// can be searched for at