Skip to content

Instantly share code, notes, and snippets.

@navin-bhaskar
navin-bhaskar / bfs_dfs.py
Last active October 31, 2023 11:14
BFS DFS Pygame
import pygame as pg
import sys
from collections import deque
WALL = 1
PATH = 0
VISITING = 2
DONE = 3
VISITED = 4
@navin-bhaskar
navin-bhaskar / sol.py
Last active October 3, 2023 13:55
Assasin in maze
import pprint
from collections import deque
import os
import time
X_MARK = "X"
def solve(inp_array):
rows = len(inp_array)
#include <mraa.h>
#include <signal.h>
#define PWM_PIN 5 /**< The pin where the LED is connected */
volatile int keepRunning;
/** Signal handler used to stop this application cleanly */
void handler(int arg)
#include <mraa.h>
#include <inttypes.h>
#define LED_PIN 5 /**< The pin where the LED is connected */
#define BTN_PIN 6 /**< Button is connected to this pin */
int main(void)
{
/**
*
* This is a 'c' program that demos the usage of the mraa library
* to blink an LED connected to port D5 on Intel Edison/Galileo
*
* setup:
* The LED is connected to port D5
*
* Compilation:
* gcc -o blink blinky.c -lmraa
#!/usr/bin/python
import pyupm_grove
import mraa
import time
import sys
"""
This script demonstrates the usage of the light sensor using upm
@navin-bhaskar
navin-bhaskar / SConstruct
Last active August 28, 2015 07:00
The SConstruct for compiling arduino sketches on Intel IOT platfrom (as opposed to the standard "for" using arduino IDE)
# Build the "core libraray" for compiling arduino on Edison
#board = "Galileo Gen2"
#board = "Galileo"
board = "Edison"
options = "-m32 -march=i586 -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -D__ARDUINO_X86__ -Xassembler -march=i586 -m32 -DARDUINO=153"
output = "-Os -Wl,--gc-sections -march=i586"
if board == "Edison":
@navin-bhaskar
navin-bhaskar / temp_upm.py
Created April 8, 2015 16:57
Temperature sensor using upm
import pyupm_grove # Get the UPM library
# Create the temperature sensor object
temp = pyupm_grove.GroveTemp(1)
# Use "value" method on it to get the temperature
print "Temperature now is " + str(temp.value())
@navin-bhaskar
navin-bhaskar / temp_mraa.py
Created April 8, 2015 16:56
Temperature sensor using mraa
#!/usr/bin/python
import mraa
import time
import math
# More info here -> http://www.seeedstudio.com/wiki/Grove_-_Temperature_Sensor
B=3975
ain = mraa.Aio(1)
@navin-bhaskar
navin-bhaskar / adc.py
Created April 8, 2015 15:29
ADC example on Intel Galileo/Edison
#!/usr/bin/python
import mraa
import time
PWM_PIN = 5
ADC_PIN = 0 # Analog in pin
ROT_MAX = 1024.0 # Max value as measured by ADC when pot is connected
# Set up the PWM