Presentation is loading. Please wait.

Presentation is loading. Please wait.

Arduino libraries Datatekniker Udvidet hardware/software.

Similar presentations


Presentation on theme: "Arduino libraries Datatekniker Udvidet hardware/software."— Presentation transcript:

1 Arduino libraries Datatekniker Udvidet hardware/software

2 h file © Mercantec 2014 #ifndef __CLASSBLINK_H__ #define __CLASSBLINK_H__ class classBlink { void blink(); void setup(); }; //classBlink extern classBlink BLINK;//Instantiat static classBlink #endif //__CLASSBLINK_H__

3 cpp file © Mercantec 2014 #include "Arduino.h" //To enable use of digitalWrite etc. #include "classBlink.h" classBlink BLINK; //As defined extern in h file void classBlink::blink() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(500); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } void classBlink::setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); }

4 Program file © Mercantec 2014 #include "classBlink.h"; //classBlink BLINK; int a; // the setup function runs once when you press reset or power the board void setup() { BLINK.setup(); } // the loop function runs over and over again forever void loop() { a++; BLINK.blink(); }


Download ppt "Arduino libraries Datatekniker Udvidet hardware/software."

Similar presentations


Ads by Google