Skip to content

An arduino library to communicate serial in HaLakeKitFirst style.

Notifications You must be signed in to change notification settings

nyampass/HaLakeKitFirst-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HaLakeKitFirst

An arduino library to communicate serial in HaLakeKitFirst style.

Install

You can install by using library manager.

[Sketch] -> [Include Library] -> [Manage Libraries..] -> search "halakekitfirst" then install it.

Useage

If you want to get some sample, see examples of this project.

Definition

#ifdef USBCOM
// For Arduino Leonardo ets.. that its Serial is only for USB communication.
HaLakeKirFirst kitFirst(&Serial1);
#else
// For Arduino UNO etc..
HaLakeKitFirst kitFirst(&Serial);
#endif

void setup() {
  kitFirst.begin();
}

Send

int value = analogRead(SOME_PIN);
kitFirst.send(value,
              0,   // min value to send
              1023); // max value to send

Receive

int value;
if (kitFirst.receive()) {
  value = kitFirst.getReceivedValue(0,
                                    255);
}
analogWrite(SOME_PIN, value);