Scala and arduino

Hi,

For whom are interested, you can write arduino programs in scala (see scala-lang). Proceed as follows:

1 - Install scala.
2 - Install Eclipse and add scala plugin.
3 - Install Processing.
4 - Download and install jccs.jar to your-jdk/jre/lib/ext repository.

Open eclipse. Create a new scala project. Right-click on the project name. Select "libraries tag". Add the following jar to your project path.

core.jar (processing)
serial.jar (processing)
jssc.jar (no need to be added. It is in your java classpath)
arduino.jar (processing)

Add the following two files in attachment to your project. This a sample program: an LED 'll blink.

1st file ArduinoTest.scala

import processing.serial.Serial
import processing.core.PApplet

object ArduinoTest extends App {

override def main (arg: Array[String]) : Unit = {
PApplet.main(ArrayString)
}

}

2nd file: Test.scala

import processing.core.PApplet
import cc.arduino.Arduino
import processing.serial.Serial

class Test extends PApplet {

var arduino : Arduino = null

override def setup = {
arduino = new Arduino(this,Arduino.list()(0),57600)
arduino.pinMode(13,Arduino.OUTPUT)
}

override def settings () = {
size(200,200)
}

override def draw () = {
arduino.digitalWrite(13,Arduino.HIGH)
delay(100)
arduino.digitalWrite(13,Arduino.LOW)
delay(100)
}

}

Sal├╝