This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Welcome to Jeff's first 5 minute intro to Python. | |
# More illustrative of a language than just the syntax, I think | |
# how a language handles data says a lot. So, I'm going to talk | |
# mostly about that, and let's start with lists. | |
# Since we all know how to program, I'm going to just leave a lot to | |
# be picked up by example rather than by exposition. | |
# --- save as 'listsarecool.py' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Welcome back for Jeff's second 5 minute intro to Python. | |
# This time we'll talk about the list's immutable cousin, the tuple. | |
from collections import namedtuple | |
def main(): | |
# tuples can be considered as immutable lists. A lot of what | |
# I'm going to show you here can also be done with lists, but | |
# it seems to fit better here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------ | |
// Interrupt 0 fires on pin D2 | |
#define IR_PIN 2 | |
// the maximum pulse we'll listen for | |
#define MAX_PULSE 30000 | |
// the largest message we expect to receive (in bits) | |
#define MAX_MSG_SIZE 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------ | |
// Interrupt 0 fires on pin D2 | |
#define IR_PIN 2 | |
// the maximum pulse we'll listen for | |
#define MAX_PULSE 30000 | |
// the largest message we expect to receive (in bits) | |
#define MAX_MSG_SIZE 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//------------------------------------------------------------------------------ | |
// | |
// An Arduino Scheduler Framework with Remote-control Sleep Mode. | |
// | |
// For details, see my blog post: | |
// http://houseofjeff.com/2014/07/15/a-scheduling-framework-remote-control-sleep-mode-for-arduino/ | |
// | |
// This sample is licensed under the MIT License (MIT) | |
// Copyright (c) 2014, by Jeff House | |
// Full text of license at the bottom of the file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
import re | |
import random | |
from datetime import datetime, timedelta | |
def main(): | |
timing_test(100000) | |
def simple_test(): |