Skip to content

Instantly share code, notes, and snippets.

View mvidalgarcia's full-sized avatar
🐛
Feeding bugs

Marco Vidal García mvidalgarcia

🐛
Feeding bugs
View GitHub Profile
#include <stdio.h>
#include <string.h>
void func(char *str)
{
char buffer[100]; /* adjust size of buffer to suit */
strcpy (buffer,str);
}
void main (int argc, char *argv[])
{
func(argv[1]);
@mvidalgarcia
mvidalgarcia / temp_hum_fuzzifier_example.py
Created November 13, 2015 14:13
Example of fuzzy logic with skfuzzy library
import numpy as np
import skfuzzy as fuzz
CURRENT_TEMP = 15
CURRENT_HUM = 50
x_temp = np.arange(-20, 41, 1)
x_hum = np.arange(0, 101, 1)
x_sys = np.arange(12, 36, 1)
Line: 4, column: 1, token: 261, semantic value: int
Line: 4, column: 5, token: 274, semantic value: i
Line: 4, column: 6, token: 44, semantic value: ,
Line: 4, column: 7, token: 274, semantic value: j
Line: 4, column: 8, token: 59, semantic value: ;
Line: 6, column: 1, token: 261, semantic value: int
Line: 6, column: 5, token: 274, semantic value: f
Line: 6, column: 6, token: 40, semantic value: (
Line: 6, column: 7, token: 261, semantic value: int
Line: 6, column: 11, token: 274, semantic value: a
import os
import time
os.system('modprobe w1-gpio')
os.system('modprobe w1_therm')
temp_sensor = '/sys/bus/w1/devices/28-0215635d39ff/w1_slave'
def temp_raw():
f = open(temp_sensor, 'r')
from random import uniform, randint
import time
import json
__author__ = 'mvidalgarcia'
current_milli_time = lambda: int(round(time.time() * 1000))
cat_description = [
{'category_id': 2, 'description': "OMG I lost my pocket. Somebody robbed me"},
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
buzzer_pin = 24
GPIO.setup(buzzer_pin, GPIO.OUT)
def buzz():
GPIO.output(buzzer_pin, True)
time.sleep(0.0001)