Skip to content

Instantly share code, notes, and snippets.

View wildan3105's full-sized avatar
⌨️
Typing things remotely

Wildan S. Nahar wildan3105

⌨️
Typing things remotely
View GitHub Profile
const byte adcPin = 0; // A0
const int MAX_RESULTS = 256;
volatile int results [MAX_RESULTS];
volatile int resultNumber;
// ADC complete ISR
ISR (ADC_vect)
{
if (resultNumber >= MAX_RESULTS)
ADCSRA = 0; // turn off ADC
@wildan3105
wildan3105 / .estlintrc.json
Last active September 16, 2017 11:56
Airbnb-inspired eslintrc configuration
{
"extends": "eslint:recommended",
"env": {
"es6":true,
"browser": true,
"node": true
},
"rules": {
"arrow-body-style":"error",
"array-bracket-spacing":"error",
/*
* File: newmain.c
* Author: Wildan S. Nahar
*
* Created on April 27, 2017, 7:01 PM
*/
#define FCY 16000000UL
#include <xc.h>
// FBS
#pragma config BWRP = BWRP_OFF // Boot Segment Write Protect (Boot Segment may be written)
#pragma config BSS = NO_BOOT_CODE // Boot Segment Program Flash Code Protection (No Boot Segment)
// FGS
#pragma config GWRP = GWRP_OFF // General Code Segment Write Protect (General Segment may be written)
#pragma config GSS = GSS_OFF // General Segment Code Protection (Disabled)
// FOSCSEL
#pragma config FNOSC = PRIOSC // Oscillator Mode (Primary Oscillator (HS, EC))
#define FCY 8000000UL // FCY = FOSC / 2
#include <xc.h>
#include <stdio.h>
#include <libpic30.h>
#include <config.h>
int main(void)
{
int channel1Result;
app.post('/results', function(req, res){
var post = {}
post.date = new Date(),
post.temp = req.body.temp
sql.query('INSERT INTO analog_read SET ?', post, function(err, results, fields){
if(err) throw err;
console.log('sent success with value : ', post.temp)
res.json({'status':'success!'})
})
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = { 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x01 }; // RESERVED MAC ADDRESS
EthernetClient client;
long previousMillis = 0;
unsigned long currentMillis = 0;
long interval = 3000; // READING INTERVAL
float p = 0.00;
#define FCY 8000000UL // FCY = FOSC / 2
#include <xc.h>
#include <stdio.h>
#include <libpic30.h>
#include <p30F2020.h>
#include "config.h"
int main(void)
{