Skip to content

Developing Custom Scripts and Firmware

Owen Schwartz edited this page Jul 8, 2020 · 8 revisions

Set up the Arduino IDE

  1. Download and install the Arduino IDE.
  2. Open preferences
  3. Next to "Additional Boards Manager URLs:" paste the following URL: https://raw.githubusercontent.com/oschwartz10612/Scanner-Pro-MK3/master/arduino_board/package_scannerpro_index.json
  4. Click "Okay"
  5. Add the board in boards manager. Tools > Board > Boards Manager...
  6. Scroll to the bottom to "Scanner Pro MK3"
  7. Hover over the entry and click install.

Write your script

It is recommended to start with the simple example. You can find this under File > Examples > Examples From Custom Libraries > ScannerPro > Simple_Start

This simple example sketch walks you through using basic functions of the board.

#include <Scanner.h>

Scanner Scanner;

String data;

void setup() {
  //Put your code here to run once
}

void loop() {
  //Put your code here to loop
  
  if(Scanner.available()) { //Check if there is data to read from the scanner
    
    data = Scanner.read_enter(); //Read the scanner data into a string. Use Scanner.read_tab() if your device uses tabs.

    //Example munipulation
    Scanner.print(data); //Print the scanner data
    Scanner.write(10); //Send a new line
    Scanner.print("END"); //Print the text "END"
  }
  
}

The Library

The library is included with the board installation. It can be included in a new sketch with the following

#include <Scanner.h>

See the library documentation for more information.

Export your firmware

Sketch > Export compiled Binary

The binary hex file will be placed into your sketch folder.

Make a pull request!

Once you have written your firmware, open a pull request to add it to the repository in the firmware directory so others can use your script.