Skip to content

Instantly share code, notes, and snippets.

@psbots
psbots / avoidobstacle.pde
Last active April 26, 2024 04:02
Obstacle Avoiding Robot- Arduino code
//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;
@psbots
psbots / bisection.py
Last active December 13, 2015 20:39
Bisection method to find roots of a non-linear equation
#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 / accbot.js
Created January 21, 2014 18:44
Android Accelerometer controlled bot via WebSockets. For more info visit : http://psbots.blogspot.in/2014/01/open-web-and-open-hardware-android.html
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 / client.py
Created July 13, 2017 10:34 — forked from dbehnke/client.py
Python AsyncIO Client and Server Example using StreamReader and StreamWriter
"""
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