Skip to content

Instantly share code, notes, and snippets.

View surejm's full-sized avatar

Surej Mouli surejm

  • Aston University
  • Birmingham
View GitHub Profile
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char* ssid = "........";
const char* password = "........";
ESP8266WebServer server(80);
import time
import board
from digitalio import DigitalInOut, Direction, Pull
import pwmio
from analogio import AnalogIn
led1 = pwmio.PWMOut(board.GP7, frequency=5000, duty_cycle=0)
led2 = DigitalInOut(board.GP8)
led2.direction = Direction.OUTPUT
@surejm
surejm / OttoMakerPiRP2040.ino
Created June 21, 2021 13:44 — forked from suadanwar/OttoMakerPiRP2040.ino
This sample code is for OTTO DIY Robot using Maker Pi RP2040.
/* Otto DIY Robot
by Suad Anwar
This sample code is for Otto DIY Robot using Maker Pi RP2040 board.
https://my.cytron.io/p-maker-pi-rp2040-simplifying-robotics-with-raspberry-pi-rp2040
*/
#include <Servo.h>
#define PIN_YL 12 //servo[0] left leg
@surejm
surejm / README.md
Created May 27, 2021 20:05 — forked from manuelbl/README.md
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
@surejm
surejm / short_version.py
Created June 11, 2020 09:05 — forked from miloharper/short_version.py
A neural network in 9 lines of Python code.
from numpy import exp, array, random, dot
training_set_inputs = array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]])
training_set_outputs = array([[0, 1, 1, 0]]).T
random.seed(1)
synaptic_weights = 2 * random.random((3, 1)) - 1
for iteration in xrange(10000):
output = 1 / (1 + exp(-(dot(training_set_inputs, synaptic_weights))))
synaptic_weights += dot(training_set_inputs.T, (training_set_outputs - output) * output * (1 - output))
print 1 / (1 + exp(-(dot(array([1, 0, 0]), synaptic_weights))))
@surejm
surejm / convert_obci_csv_to_openvibe.py
Created July 25, 2019 09:44 — forked from Photosynthesis/convert_obci_csv_to_openvibe.py
Convert OpenBCI CSV data to Openvibe format
import csv
import os
import sys
''' CONFIG '''
# PATHS
''' Path relative to this script for input data files '''
input_path = 'input'