From 0bf53d6b05db71fc4dbf1b64bf6d664602c989f7 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 21 Jul 2018 20:13:05 -0700 Subject: [PATCH] Move example sketch to appropriately named folder The Arduino IDE requires the sketch folder name to match the filename of the primary sketch file. This change causes the example sketch to be accessible via the Arduino IDE's File > Examples > LIBRARYNAME menu after the library is installed. Reference: https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#library-examples --- examples/{ => FastPin}/FastPin.pde | 156 ++++++++++++++--------------- 1 file changed, 78 insertions(+), 78 deletions(-) rename examples/{ => FastPin}/FastPin.pde (94%) diff --git a/examples/FastPin.pde b/examples/FastPin/FastPin.pde similarity index 94% rename from examples/FastPin.pde rename to examples/FastPin/FastPin.pde index b4344f1..3026596 100644 --- a/examples/FastPin.pde +++ b/examples/FastPin/FastPin.pde @@ -1,79 +1,79 @@ -#include - -//output for flashing LED; -#define LED 7 -//Button Input -#define BUTTON 8 - -//New pin class -pin led, - button; - -void setup() -{ - //Old way off defining digital pin directions. - pinMode(LED,OUTPUT); - pinMode(BUTTON,OUTPUT); - //New way - led.setup(LED,OUTPUT); - button.setup(BUTTON,OUTPUT); - Serial.begin(9600); -} - -void loop() -{ - int i; - unsigned long time1, - time2, - oldtime, - newtime; - - time1=micros(); - //cycle the led output using the old control 100 times - for(i=0;i<100;i++) - { - digitalWrite(LED,HIGH); - digitalWrite(LED,LOW); - } - time2=micros(); - oldtime=time2-time1; - Serial.print("Old method: "); - Serial.print(oldtime); - Serial.println("ms"); - - time1=micros(); - for(i=0;i<100;i++) - { - led.set(HIGH); - led.set(LOW); - } - time2=micros(); - newtime=time2-time1; - Serial.print("New method: "); - Serial.print(newtime); - Serial.println("ms"); - - i=0; - while(i<100) - { - //Old method of reading digital lines - if(digitalRead(BUTTON)) - i++; - } - Serial.println("Old digital read done"); - - i=0; - while(i<100) - { - //New method of reading digital lines - if(button.get()) - i++; - } - Serial.println("New digital read done"); - - while(1) - {} -} - - +#include + +//output for flashing LED; +#define LED 7 +//Button Input +#define BUTTON 8 + +//New pin class +pin led, + button; + +void setup() +{ + //Old way off defining digital pin directions. + pinMode(LED,OUTPUT); + pinMode(BUTTON,OUTPUT); + //New way + led.setup(LED,OUTPUT); + button.setup(BUTTON,OUTPUT); + Serial.begin(9600); +} + +void loop() +{ + int i; + unsigned long time1, + time2, + oldtime, + newtime; + + time1=micros(); + //cycle the led output using the old control 100 times + for(i=0;i<100;i++) + { + digitalWrite(LED,HIGH); + digitalWrite(LED,LOW); + } + time2=micros(); + oldtime=time2-time1; + Serial.print("Old method: "); + Serial.print(oldtime); + Serial.println("ms"); + + time1=micros(); + for(i=0;i<100;i++) + { + led.set(HIGH); + led.set(LOW); + } + time2=micros(); + newtime=time2-time1; + Serial.print("New method: "); + Serial.print(newtime); + Serial.println("ms"); + + i=0; + while(i<100) + { + //Old method of reading digital lines + if(digitalRead(BUTTON)) + i++; + } + Serial.println("Old digital read done"); + + i=0; + while(i<100) + { + //New method of reading digital lines + if(button.get()) + i++; + } + Serial.println("New digital read done"); + + while(1) + {} +} + +