Skip to content

Instantly share code, notes, and snippets.

View facchinm's full-sized avatar
🐢

Martino Facchin facchinm

🐢
  • Arduino
  • Torino, Italy
View GitHub Profile
@facchinm
facchinm / pulseInDue.ino
Last active August 29, 2015 14:16
pulseIn example for Arduino Due
const int pwmPin = 13;
const int inPin = 3;
const int pulseLenIn = 50;
int pulseLen;
volatile boolean l;
void TC3_Handler()
{
TC_GetStatus(TC1, 0);
digitalWrite(pwmPin, l = !l);
@facchinm
facchinm / leo_usb2serial
Created March 16, 2015 09:33
Leonardo USB to Serial converter
/*
leo_usb2serial
Allows to use an Arduino Leonardo as an usb to serial converter.
*/
void setup() {
Serial.begin(115200);
Serial1.begin(115200);
}
@facchinm
facchinm / YUN commands
Created March 17, 2015 14:11
YUN commands
# extracted from https://github.com/arduino/YunBridge
('a', CONNECTED_Command())
('b', WRITE_TO_ALL_Command())
('c', CONNECTING_Command())
('d', DATASTORE_GET_Command())
('f', CLOSE_Command())
('g', WRITE_Command())
('i', ISDIRECTORY_Command())
('j', CLOSE_Command())
From d0ce7cd7f072aa6cd641a2110b2f269986875f7b Mon Sep 17 00:00:00 2001
From: Martino Facchin <m.facchin@arduino.cc>
Date: Fri, 20 Mar 2015 13:07:38 +0100
Subject: [PATCH] Fix examples on eeprom library v2
---
.../EEPROM/examples/eeprom_crc/eeprom_crc.ino | 4 +-
.../EEPROM/examples/eeprom_get/eeprom_get.ino | 4 +-
.../examples/eeprom_iteration/eeprom_iteration.ino | 19 +----
.../examples/eeprom_pointer/eeprom_pointer.ino | 74 -----------------
@facchinm
facchinm / check_da.ino
Created March 23, 2015 10:00
Test + benchmark for bug #2198
/*
Setup:
A0 <-> 3.3V
A9 <-> A7
A9 <-> 5
A3 -> floating
expected behavior:
digitalRead(A0) == 1
// watchdog sam test
// initialize watchdog and then hardfault
// and see averything restarting
int counter = 0;
int limit = 200;
int limit2 = 0;
void print2(void) {
Serial.println("print2");
@facchinm
facchinm / dot2json.py
Last active August 29, 2015 14:21
dot notation to json
import itertools
import collections
import pprint
import json
import os
import dicttoxml
def dot_to_json(a,b):
output = {}
for index, key in enumerate(a):
package main
import (
//"flag"
"bytes"
//"crypto/rand"
"fmt"
"github.com/facchinm/go-serial"
"math/rand"
"os"
#if defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAM_DUE)
#define SERIAL_PORT SerialUSB
#else
#define SERIAL_PORT Serial
#endif
uint8_t speedTestBuffer[256];
void setup()
{
compiler.path=/usr/bin/
# These can be overridden in platform.local.txt
compiler.c.extra_flags=-Wextra -flto
compiler.c.elf.extra_flags=-w -flto -fuse-linker-plugin
compiler.S.extra_flags=-flto
compiler.cpp.extra_flags=-Wextra -flto
compiler.ar.extra_flags=--plugin=/usr/lib/gcc/avr/4.9.2/liblto_plugin.so
compiler.objcopy.eep.extra_flags=
compiler.elf2hex.extra_flags=