Skip to content

Instantly share code, notes, and snippets.

@Nsk1107
Nsk1107 / crc16_modbus_rtu.c
Last active March 7, 2019 08:02
CRC16 calculation for Modbus RTU
//data[] is byte array to calculate CRC16
byte res[8]; //result is stored in this array
void ModRTU_CRC(byte data[]) {
uint16_t crc = 0xFFFF;
for (int pos = 0; pos < 6; pos++) { //6 is data array length
res[pos] = data[pos];
crc ^= (uint16_t)data[pos]; // XOR byte into least sig. byte of crc
for (int i = 8; i != 0; i--) { // Loop over each bit
@Nsk1107
Nsk1107 / A6_test.ino
Created September 27, 2017 16:49
This simple code can be use to send a text message and make a voice call using AI Thinker A6 GSM/GPRS Module.
#include <SoftwareSerial.h>
SoftwareSerial A6Module(10, 11); //RX,TX
char input='\0';
void setup() {
A6Module.begin(115200);
Serial.begin(9600);
delay(500);
@Nsk1107
Nsk1107 / A6_test.ino
Created September 27, 2017 16:49
This simple code can be use to send a text message and make a voice call using AI Thinker A6 GSM/GPRS Module.
#include <SoftwareSerial.h>
SoftwareSerial A6Module(10, 11); //RX,TX
char input='\0';
void setup() {
A6Module.begin(115200);
Serial.begin(9600);
delay(500);
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
int starttime;
int activetime;
int prevoustime = 0;
//set time before compile+++++++++++
int hours = 19;
@Nsk1107
Nsk1107 / nokia1100.ino
Last active February 8, 2017 08:07
FBH.Priyantha Rupasinghe
/*
NOKIA 1100 Screen
This is the driver of the LCD based on code by spiralbrain
modified by:
name:kuldeep singh dhaka
email:kuldeepdhaka9@gmail.com
date:17 May 2012
Source: http://sunbizhosting.com/~spiral/
Driver For Arduino Dueminalove Atmega328
@Nsk1107
Nsk1107 / defTstWindow.py
Created November 21, 2016 17:24
Label updating using after()
import sys
import cv2
from PIL import Image, ImageTk
from Tkinter import Tk, Label
import Support
def vp_start_gui():
'''Starting point when module is the main routine.'''
global val, w, root
import CamHandler
import defTstWindow
import threading
import time
threading.Thread(target=CamHandler.getFrame).start()
time.sleep(1)
threading.Thread(target=defTstWindow.makeGUI).start()
import sys
import cv2
import Image, ImageTk
from Tkinter import *
import Support
def makeGUI():
top=Tk()
import cv2
import numpy as np
import Support
cam=cv2.VideoCapture(0)
def getFrame():
while 1:
_,frm=cam.read()
import cv2
global frame
frame=None