This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load Grove module | |
var groveSensor = require('jsupm_grove'); | |
var FormData = require('form-data'); | |
var fs = require('fs'); | |
// we want mraa to be at least version 0.6.1 | |
var mraa = require('mraa'); | |
var version = mraa.getVersion(); | |
var tSampFileName='t_samp.csv'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
04-24 22:12:03.830 18041-18139/com.xxx.xxx.smarthook E/AndroidRuntime: FATAL EXCEPTION: MQTT Con: 02:00:00:00:00:00 | |
Process: com.xxx.xx.smarthook, PID: 18041 | |
java.lang.NullPointerException: cancel() called with a null PendingIntent | |
at android.app.AlarmManager.cancel(AlarmManager.java:890) | |
at org.eclipse.paho.android.service.AlarmPingSender.stop(AlarmPingSender.java:86) | |
at org.eclipse.paho.client.mqttv3.internal.ClientComms.shutdownConnection(ClientComms.java:327) | |
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:608) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<reg51.h> | |
void delay_us(unsigned int us_count) | |
{ | |
while((us_count*4)!=0) | |
{ | |
us_count--; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install build-essential | |
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev | |
sudo apt-get install python-dev python-numpy libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev | |
sudo apt-get install python-opencv | |
sudo apt-get install opencv | |
sudo apt-get install python-matplotlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import picamera | |
import cv2 | |
import numpy | |
#Create a memory stream so photos doesn't need to be saved in a file | |
stream = io.BytesIO() | |
#Get the picture (low resolution, so it should be quite fast) | |
#Here you can also specify other parameters (e.g.:rotate the image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Load a cascade file for detecting faces | |
face_cascade = cv2.CascadeClassifier('/home/pi/Desktop/opencv/haarcascade_frontalface_default.xml') | |
eye_cascade = cv2.CascadeClassifier('/home/pi/Desktop/opencv/haarcascade_eye.xml') | |
#Convert to grayscale | |
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) | |
#Look for faces in the image using the loaded cascade file | |
faces = face_cascade.detectMultiScale(gray, 1.3, 5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
import numpy | |
import cv2 | |
face_cascade = cv2.CascadeClassifier('/home/pi/Desktop/opencv/haarcascade_frontalface_default.xml') | |
eye_cascade = cv2.CascadeClassifier('/home/pi/Desktop/opencv/haarcascade_eye.xml') | |
img = cv2.imread('sachin.jpg') | |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
faces = face_cascade.detectMultiScale(gray, 1.3, 5) | |
for (x,y,w,h) in faces: | |
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
serOut=2 --SER pin | |
clk=1 --shift register clock (SRCLK) | |
latch=3 -- Storage register clock (RCLK) | |
loadStatus=0 --use only 16 bits | |
gpio.mode(clk,gpio.OUTPUT) | |
gpio.mode(serOut,gpio.OUTPUT) | |
gpio.mode(latch,gpio.OUTPUT) | |
local function sendClk() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function consume_data( payload ) | |
--we will parse the payload and excute it,publish the return value | |
print(payload) | |
msg=cjson.decode(payload) | |
loadNumber=msg.ln | |
targetStatus=msg.ts | |
if(targetStatus==0) then loadStatus=bit.clear(loadStatus,loadNumber) | |
else loadStatus = bit.set(loadStatus,loadNumber) end | |
serialOut(loadStatus) | |
print ("Status of the loads : ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.siva.com.hellokotlin | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import kotlinx.android.synthetic.main.activity_main.* | |
import org.jetbrains.anko.toast | |
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { |
OlderNewer