Skip to content

Instantly share code, notes, and snippets.

View skarcha's full-sized avatar

Antonio Pérez skarcha

View GitHub Profile
@skarcha
skarcha / validate_spanish_id.js
Last active February 29, 2024 09:24 — forked from afgomez/validate_spanish_id.js
Spanish DNI, CIF, NIE validator
/**
* ValidateSpanishID. Returns the type of document and checks its validity.
*
* Usage:
* ValidateSpanishID( str );
*
* > ValidateSpanishID( '12345678Z' );
* // { type: 'dni', valid: true }
*
* > ValidateSpanishID( 'B83375575' );
@skarcha
skarcha / gist:1407304
Created November 30, 2011 00:18
Using LCD with Arduino
/*
Show analog input value using a LCD.
Turn on and off the backlight with a button.
By Antonio Perez <aperez@skarcha.com>
Public Domain
*/
// include the library code:
@skarcha
skarcha / gist:1402728
Created November 29, 2011 00:12
Knight Rider led simulation for Arduino
/*
Knight Rider led simulation for Arduino
By Antonio Perez <aperez@skarcha.com>
Public Domain
*/
const int analogInPin = A0;
const int ledPins[] = {3, 5, 6, 9, 10, 11};
const int pinCount = 6;
const int brightAmount = (255 / (pinCount / 3));