Skip to content

Instantly share code, notes, and snippets.

@prasertsakd
prasertsakd / webserver.ino
Last active January 9, 2023 23:36
Webserver for Arduino ESP8266
//Leonardo
Serial_ & dbgTerminal = Serial;
HardwareSerial & espSerial = Serial1;
////UNO & M328P
//#include <SoftwareSerial.h>
//SoftwareSerial dbgTerminal(10, 11); // RX, TX
//HardwareSerial & espSerial = Serial;
//
[
{
"id": "49613054.b1d67",
"type": "xml",
"z": "31f47a75.15b9d6",
"name": "",
"property": "payload",
"attr": "",
"chr": "",
"x": 390,
int timer = 100;
const PROGMEM unsigned int ledPins[] =
{ 0,1,2,3,4,0,1,2,3,4,
4,3,2,1,0,4,3,2,1,0,
0,1,2,3,4,4,3,2,1,0,
4,3,2,1,0,0,1,2,3,4,};
const PROGMEM unsigned int stepCount = 10;
@prasertsakd
prasertsakd / ASCIITable.ino
Created December 14, 2017 09:56
ASCII table for samd21
/*
ASCII table
Prints out byte values in all possible formats:
* as raw binary values
* as ASCII-encoded decimal, hex, octal, and binary values
For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
The circuit: No external hardware needed.
created 2006
by Nicholas Zambetti
modified 9 Apr 2012
##############################################################
# NodeWifi chip has built-in 1MB flash
nodewifi.name=NodeWifi
nodewifi.upload.tool=esptool
nodewifi.upload.speed=115200
nodewifi.upload.resetmethod=nodemcu
nodewifi.upload.maximum_size=434160
nodewifi.upload.maximum_data_size=81920
@prasertsakd
prasertsakd / check_mega16u2.bat
Last active March 3, 2017 15:37
read chip id and verify
@echo off
set arduino_path=c:\arduino-1.6.12
set avrdude.exe=%arduino_path%\hardware\tools\avr\bin\avrdude.exe
set avrdude.conf=%arduino_path%\hardware\tools\avr\etc\avrdude.conf
%avrdude_path% -c usbtiny -v -p m16u2 -C %avrdude_conf%
@prasertsakd
prasertsakd / flash_mega16u2.bat
Last active March 3, 2017 15:13
for reflash mega16u2 to usbserial use avrdude
@echo off
set arduino_path=c:\arduino-1.6.12
set firmware=Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex
set avrdude.exe=%arduino_path%\hardware\tools\avr\bin\avrdude.exe
set avrdude.conf=%arduino_path%\hardware\tools\avr\etc\avrdude.conf
%avrdude_path% -c usbtiny -p m16u2 -C %avrdude_conf% -F -D -U flash:w:%firmware% -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m
#include <stdio.h>
void app_main() {
printf("Hello world\n");
}
#include <PN532.h>
#include "Keyboard.h"
//#define SCK 13
//#define MOSI 11
//#define SS 10
//#define MISO 12
#define SCK 15
#define MOSI 16
const int ledPin = 2; // the number of the LED pin
const int threshold = 40; // the number of the LED pin
int ledState = LOW; // ledState used to set the LED
void setup() {
// put your setup code here, to run once:
//pinMode(ledPin, OUTPUT);
Serial.begin(115200);
touchAttachInterrupt(T0 , click , threshold );