Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created January 1, 2020 10:06
Show Gist options
  • Save kmizu/bc360bad5cf1d125136d090776f43369 to your computer and use it in GitHub Desktop.
Save kmizu/bc360bad5cf1d125136d090776f43369 to your computer and use it in GitHub Desktop.
Code snippet to control Raspberry Pi from Scala (sbt console)
scalaVersion := "2.13.1"
name := "pi4r"
version := "0.0.1-SNAPSHOT"
libraryDependencies ++= Seq(
"com.pi4j" % "pi4j-core" % "1.2",
"com.pi4j" % "pi4j-device" % "1.2",
"com.pi4j" % "pi4j-gpio-extension" % "1.2",
"com.pi4j" % "pi4j-service" % "1.1",
"com.pi4j" % "pi4j-native" % "1.2" pomOnly()
)
initialCommands in console += {
Iterator(
"com.pi4j.io.gpio._",
"com.pi4j.wiringpi._"
).map("import "+).mkString("\n") + "\n" +
"Gpio.wiringPiSetupGpio()\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment