Skip to content

Instantly share code, notes, and snippets.

/**
* Problem definition: https://github.com/mikehadlow/Journeys
* Edit and run this code here: https://pl.kotl.in/_TytttU28
*/
package com.tomkuhn.journey
import com.tomkuhn.journey.Direction.*
enum class Direction { North, East, South, West }
var SerialPort = require('serialport');
var port = new SerialPort('COM4', function (err) {
if (err) {
return console.log('Error: ', err.message);
}
});
port.on('data', function (data) {
// general debug function: print serial data
console.log('Data:', data.toString());
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 90; // variable to store the servo position
int resetPos= 100;
int maxPos = 150;
int minPos=50;