Skip to content

Instantly share code, notes, and snippets.

@nseidle
Last active September 29, 2016 17:21
Show Gist options
  • Save nseidle/43a262c37540ffc855cf5b7f08356056 to your computer and use it in GitHub Desktop.
Save nseidle/43a262c37540ffc855cf5b7f08356056 to your computer and use it in GitHub Desktop.
This is just a snippet. The full files are here: https://github.com/sparkfun/Genericized_Library_Examples
#include "Laser.h" //The example lib
Laser myLaser; //Instantiate an instance of the class
void setup()
{
Serial.begin(9600); //We have to start the serial port before we call begin()
myLaser.begin(Serial); //Pass the port object to the library
}
void loop()
{
myLaser.sendCommand("Fire the laser!"); //Send a serial command to the device
Serial.println("Command sent"); //For Uno
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment