Skip to content

Instantly share code, notes, and snippets.

@samirsogay
samirsogay / assistant_library_with_local_commands_remote.py
Created October 13, 2018 13:02
Python Script to take custom voice commands for Google AIY Voice Kit
#!/usr/bin/env python3
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@samirsogay
samirsogay / mqtt_lpg_gas.ino
Created January 5, 2019 12:48
LPG Cylinder Leakage Sensor using MQ6 Sensor and ESP8266
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char* ssid = "Ermenegildo Zegna";
const char* password = "hhjw-ofvq-pafm";
//const char* mqtt_server = "test.mosquitto.org";
const char* mqtt_server = "192.168.100.113";
unsigned long lastUpdate;
@samirsogay
samirsogay / BYJ48-Bipolar
Created March 16, 2019 08:44
This code is for DOIT Motor Shield which has L293D motor driver and takes a NODEMCU ESP8266 board. With this you can convert BYJ48 stepper motor from Unipolar to Bipolar
int A = D1; //EN1
int B = D2; //EN2
int C = D3; //IN1
int D = D4; //IN3
long del = 2000;
void setup() {
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
@samirsogay
samirsogay / BYJ48-Bipolar
Created March 16, 2019 08:44
This code is for DOIT Motor Shield which has L293D motor driver and takes a NODEMCU ESP8266 board. With this you can convert BYJ48 stepper motor from Unipolar to Bipolar
int A = D1; //EN1
int B = D2; //EN2
int C = D3; //IN1
int D = D4; //IN3
long del = 2000;
void setup() {
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
@samirsogay
samirsogay / toddler_tutor.ino
Created July 10, 2019 20:06
This is the code for my Project Toddler Tutor using Arduino UNO and DF Mini Audio Player which teaches kids Alphabets, Numbers, etc. The video for the project is at https://youtu.be/ju8HZb7C1EA
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
#include <Adafruit_NeoPixel.h>
#define BUTTON_1 2 // white
#define BUTTON_2 4 // yellow
#define BUTTON_3 6 // red small
#define BUTTON_4 8 // blue small
#define BUTTON_5 10 // red big
// defines pins numbers
const int stepPin = 3;
const int dirPin = 4;
void setup() {
// Sets the two pins as Outputs
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
int A = D1; //EN1
int B = D2; //EN2
int C = D3; //IN1
int D = D4; //IN3
long del = 15000;
void setup() {
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
int bluePin = 2; //IN1 on the ULN2003 Board, BLUE end of the Blue/Yellow motor coil
int pinkPin = 3; //IN2 on the ULN2003 Board, PINK end of the Pink/Orange motor coil
int yellowPin = 4; //IN3 on the ULN2003 Board, YELLOW end of the Blue/Yellow motor coil
int orangePin = 5; //IN4 on the ULN2003 Board, ORANGE end of the Pink/Orange motor coil
//going up
//Keeps track of the current step.
//We'll use a zero based index.
int currentStep = 0;
void setup() {
@samirsogay
samirsogay / gist:4e05779aa0a95fa10c6ac22d097514f0
Created July 11, 2020 15:32
Pan Tilt code for Motioneye
down_2
#!/usr/bin/env python
from __future__ import division
import time
import subprocess
with open('/etc/motioneye/vert_pos_2', 'r') as f:
vert_pos_2 = int(f.readline())
print vert_pos_2
@samirsogay
samirsogay / BeamNG.ino
Last active September 22, 2020 18:43
Arduino code for Adafruit Bluefruit for playing in BeamNG.drive.
/*********************************************************************
This is an example for our nRF51822 based Bluefruit LE modules
Pick one up today in the adafruit shop!
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!