Skip to content

Instantly share code, notes, and snippets.

Avatar

Praveen Sridhar psbots

View GitHub Profile
@psbots
psbots / client.py
Created Jul 13, 2017 — forked from dbehnke/client.py
Python AsyncIO Client and Server Example using StreamReader and StreamWriter
View client.py
"""
client.py - AsyncIO Server using StreamReader and StreamWriter
This will create 200 client connections to a server running server.py
It will handshake and run similar to this:
Server: HELLO
Client: WORLD
@psbots
psbots / accbot.js
Created Jan 21, 2014
Android Accelerometer controlled bot via WebSockets. For more info visit : http://psbots.blogspot.in/2014/01/open-web-and-open-hardware-android.html
View accbot.js
var webSocket = require('ws'),
ws = new webSocket('ws://10.0.0.3:9000/ws'),
five = require('johnny-five'),
board = new five.Board();
board.on("ready", function() {
var xspeed, turnspeed, motors;
var i1=new five.Pin(8),
i2=new five.Pin(10),
@psbots
psbots / bisection.py
Last active Dec 13, 2015
Bisection method to find roots of a non-linear equation
View bisection.py
#Bisection Method to find roots of a non linear equation
#Praveen Sridhar
#psbots.blogspot.com
def bisection(function,lower_bound,upper_bound,error_tolerance=1.0e-4):
fu=function(upper_bound)
if fu==0.0 : return upper_bound
fl=function(lower_bound)
if fl==0.0 : return lower_bound
if fu*fl > 0.0: #if the product of the function values at the two bounds is positive, then they do not bracket a root
return None
@psbots
psbots / avoidobstacle.pde
Last active Feb 6, 2020
Obstacle Avoiding Robot- Arduino code
View avoidobstacle.pde
//Obstacle Avoiding robot
//Praveen Sridhar
//psbots.blogspot.com
const int left=1,mid=2,right=3;
const int i1=8,i2=10,ea=9,i3=5,i4=7,eb=6;
const int cthres=600,rthres=600,lthres=600;
int s1=0;
int s2=0;
int s3=0;
int r;
You can’t perform that action at this time.