Skip to content

Instantly share code, notes, and snippets.

View CodeNextAdmin's full-sized avatar

Code Next CodeNextAdmin

View GitHub Profile
//ARDUINO 2 MOTOR EXAMPLE - L298N
// This version does not include the potentiometer
int SPEED = 255; // 0 - NO SPEED, 255 - FULL SPEED
//motor 1
#define enA 9 // should be pwm pin(~)
#define in1 6
#define in2 7
@CodeNextAdmin
CodeNextAdmin / hc06-bt-app-control.ino
Created March 23, 2023 22:45
Control your Arduino car with an Android Bluetooth app
/*
* Code Next Arduino Robot club
* HC-06 Bluetooth drive control with mobile app
* Downoload an Android Bluetooth HC-06 app and
* set commands to match f (forward), r (reverse)
* l (left) , r (right)
* TODO: modify this code to improve remote driveing performance
*/
#include <SoftwareSerial.h>
@CodeNextAdmin
CodeNextAdmin / hc06-LED-control.ino
Last active March 22, 2023 06:10
Turning on LED with BT HC-06
/* Code Next Arduino Robotics club
* Turn on LED via BT example
* Pair a device via Bluetooth to HC-06
* Use a Bluetooth Terminal app to send characters
*/
#include <SoftwareSerial.h>
SoftwareSerial BTserial(10, 11); // RX | TX
// Connect the HC-06 TX to the Arduino RX on pin 10.
@CodeNextAdmin
CodeNextAdmin / arduino-hc06-test.ino
Created March 20, 2023 23:14
arduino hc-06 BT Serial Test
/* Code Next Arduino Robotics club
* TEST your HC-06 with this sketch;
* - Give the Modle 5V of power (VCC)
* - Try some test commands: AT -> should reply OK
* - Rename it AT+NAMEyournewname -> should reply with OKsetname
* - Connecting to RX and TX pins (0, 1) gives an upload error if wired, use 10, 11 instead.
*/
#include <SoftwareSerial.h>
@CodeNextAdmin
CodeNextAdmin / arduino-l298n-drive-functions.ino
Created March 13, 2023 23:10
A sketch to drive an Arduino car with an L298N and 2 DC motors (with drive functions)
/* 2 MOTOR L298N and Potentiometer
* with functions (forward, reverse, turnRight, turnLeft)
* motor rotation will vary depending on the DC motor wiring
* and the orientation of the motor relative to the car/surface.
*
*/
//motor 2
#define enA 9
#define in1 6
@CodeNextAdmin
CodeNextAdmin / arduino-2-motor-l298n.ino
Last active March 7, 2023 02:52
Arduino 2 motor L298N example 1
//Speed control with 2 motors and a potentiometer
//motor 2
#define enA 9 // should be pwm pin(~)
#define in1 6
#define in2 7
////motor 2
@CodeNextAdmin
CodeNextAdmin / distance-led.py
Created October 18, 2021 22:06 — forked from CodeNextPaco/distance-led.py
GPIO Zero distance LED blink
from gpiozero import LED, DistanceSensor
from time import sleep
# DisanceSensor(echo, trigger)
sensor = DistanceSensor(26, 20)
led = LED(14)
blink_rate = 0
def blink(d):
if d < 1.0:
from gpiozero import Servo, AngularServo
from time import sleep
#servo = Servo(21)
servo = AngularServo(21, min_angle=0, max_angle=180, min_pulse_width=0.0006, max_pulse_width=0.0024)
while True:
"""
num = input("Enter a number between -1 and 1")
num = float(num)
if num <= 1 and num >= -1:
@CodeNextAdmin
CodeNextAdmin / the_tyger.txt
Created September 14, 2020 22:38
The Tyger - William Blake
The Tyger
William Blake
Tyger! Tyger! burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?
In what distant deeps or skies
Burnt the fire of thine eyes?
//make sure to add this to your package in the shell: $npm install readline-sync
const READLINE = require("readline-sync");
//*********************** VARIABLES ****************************
let inputMsg ="" //an empty string to hold our user inputs
let gameIsOn = true
let currentRoom = null
let isFighting = false
let rooms = []