Skip to content

Instantly share code, notes, and snippets.

View chaeplin's full-sized avatar

chaeplin chaeplin

View GitHub Profile
@chaeplin
chaeplin / hx711.ino
Created February 29, 2016 17:44
hx711.ino
#include "HX711.h"
// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0
HX711 scale(4, 5, 128); // parameter "gain" is ommited; the default value 128 is used by the library
void setup() {
Serial.begin(115200);
Serial.println("HX711 Demo");
@chaeplin
chaeplin / wifi_test.ino
Created February 16, 2016 15:31
wifi_test.ino
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include "/usr/local/src/ap_setting.h"
extern "C" {
#include "user_interface.h"
}
char* topic = "wifitest";
int test_para = 5000;
@chaeplin
chaeplin / struct_data_size.ino
Created February 5, 2016 00:29
struct data_size
typedef struct {
uint32_t _salt;
uint16_t volt;
int16_t data1;
int16_t data2;
uint8_t devid;
} data;
data sensor_data;
@chaeplin
chaeplin / lowreal.net_rtc_mem.ino
Last active February 1, 2016 08:14
lowreal.net_rtc_mem.ino
// from http://lowreal.net/2016/01/10/1
#include <Arduino.h>
extern "C" {
#include <user_interface.h>
};
// system_rtc_mem_write() 先のブロックアドレス。
// 4 bytes で align されており、先頭256bytes はシステム予約領域
// 64 から書けるはずだが、65 以降でないとうまくいかなかった。。
static const uint32_t USER_DATA_ADDR = 66;
@chaeplin
chaeplin / callback.ino
Last active January 29, 2016 14:50
callback.ino
void callback(char* topic, byte* payload, unsigned int length) {
String receivedtopic = topic;
String receivedpayload ;
for (int i = 0; i < length; i++) {
receivedpayload += (char)payload[i];
}
@chaeplin
chaeplin / receiver.ino
Created December 14, 2015 03:17 — forked from rlogiacco/receiver.ino
nRF24 multiple transmitters
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int senderId;
// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
//Contacts from the radio to connect NRF24L01 pinamnam -> Arduino
@chaeplin
chaeplin / Serial.test.ino
Created December 1, 2015 19:27
Serial.test
int testpin1 = 5;
void setup() {
pinMode(testpin1, OUTPUT);
}
void loop() {
Serial.begin(115200);
digitalWrite(testpin1, LOW);
delay(2000);
@chaeplin
chaeplin / analogRead.ino
Created November 28, 2015 21:53
esp8266 analogRead
int sampleI;
int Number_of_Samples;
int sumI;
void setup()
{
Serial.begin(115200);
sampleI = 0;
sumI = 0;
Number_of_Samples = 1000;
@chaeplin
chaeplin / ESP8266WiFi.ino
Last active November 17, 2015 18:48
ESP8266WiFi.ino
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include "/usr/local/src/ap_setting.h"
// Update these with values suitable for your network.
/*
char* topic = "/30/Status/MQTT";
char* subtopic = "inTopic";
#!/bin/sh
## you'll have to do a couple extra steps to get this running
## there are probably other ways to handle svncanboot, but this is from the linux forum
set -e
if
touch /etc/_testr_file
then