public class Tramontana
extends java.lang.Object
/**** Tramontana for Processing Tramontana is a tool for interactive spaces. It communicates with iOS devices. You can download the app here: https://itunes.apple.com/us/app/tramontana/id1121069555?mt=8 made by Pierluigi Dalla Rosa ***/ ///IMPORT TRAMONTANA import tramontana.library.*; ///Tramontana needs websockets that can be found at: ///https://github.com/alexandrainst/processing_websockets import websockets.*; /* Create an instance of Tramonana */ Tramontana t; void setup(){ size(480,240); /* Start the connection with Tramontana iOS/AppleTV */ t = new Tramontana(this,"192.168.1.10"); } void draw(){ background(255); fill(128); text("Hello Tramontana!",width/2-(textWidth("Hello Tramontana!")/2),height/2); } void mousePressed(){ /* This will make the haptic engine of your iDevice vibrate */ t.makeVibrate(); }
Modifier and Type | Field and Description |
---|---|
java.lang.String |
ipAddress |
static java.lang.String |
VERSION |
Constructor and Description |
---|
Tramontana(PApplet parent,
java.lang.String IP) |
Modifier and Type | Method and Description |
---|---|
void |
blinkColorEmbedded(int ledIndex,
int red,
int green,
int blue)
blinkColorEmbedded works similar to
setColorEmbedded . |
void |
getBatteryLevel() |
void |
makeVibrate()
Actuate the haptic engine.
|
void |
onMessageEvent(java.lang.String msg)
Deprecated.
Don't listen to onMessageEvent.
|
void |
playAudio(java.lang.String url)
Play a sound file (must be MP3 or WAV or AIF).
|
void |
playVideo(java.lang.String url)
Play a video file (must be MP4).
|
void |
pulseFlashLight(int numberOfPulses,
float duration,
float intensity)
Pulse the led light for the numberOfPulses (first parameter).
|
void |
reconnect()
Reconnect can be called if you lose connection with a tramontana node.
|
void |
releaseAnalogEmbedded() |
void |
releaseAttitude() |
void |
releaseAudioJack() |
void |
releaseButtonsEventEmbedded() |
void |
releaseDistance() |
void |
releaseLDREmbedded() |
void |
releaseMagnetometer() |
void |
releaseOrientation() |
void |
releasePowerSource() |
void |
releaseRxEmbedded() |
void |
releaseTouch() |
void |
releaseTouchDrag() |
void |
sendAttitudeDataToOSC(float frequency,
int port)
Activate the OSC engine to send accelerometer information, useful to communicate with wekinator for example or a live performance installation that requires better realtime performances than websockets.
|
void |
sendAttitudeDataToOSC(float frequency,
int port,
java.lang.String ip) |
void |
sendMessage(java.lang.String msg)
Deprecated.
Don't use sendMessage.
|
void |
sendSerialMessageEmbedded(java.lang.String msg)
sendSerialMessageEmbedded allows to connect a tramontana board with an other serial board like an Arduino.
|
void |
sendTouchDataToOSC(int maxNumFingers)
Activate the OSC engine to send touch data, useful to communicate with wekinator for example or a live performance installation that requires better realtime performances than websockets.
|
void |
sendTouchDataToOSC(int maxNumFingers,
int port) |
void |
sendTouchDataToOSC(int maxNumFingers,
int port,
java.lang.String ip) |
void |
setAllColorEmbedded(int red,
int green,
int blue)
setAllColorEmbedded will affect all the leds connected to a tramontana board (max 255).
|
void |
setBrightness(float brightness)
Change iDevice brightness.
|
void |
setColor(float red,
float green,
float blue,
float intensity)
Change the screen color.
|
void |
setColor(int red,
int green,
int blue,
int intensity)
Change the screen color.
|
void |
setColorEmbedded(int ledIndex,
int red,
int green,
int blue)
setColorEmbedded allows to change the color of leds connected to tramontana board (led should be WS2812).
|
void |
setFlashLight(float onValue)
Actuate the flash light.
|
void |
setRelayEmbeddedOff(int relayIndex)
setRelayEmbedded is a method to deactivate relay modules on tramontana boards.
|
void |
setRelayEmbeddedOn(int relayIndex)
setRelayEmbeddedOn is a method to activate relay modules on tramontana boards.
|
void |
setServoEmbedded(int servoIndex,
int value)
SetServoEmbedded is a method to control servo motors on tramontana boards.
|
void |
showImage(java.lang.String url)
Display an image from URL (must be PNG, JPEG or GIF[won't be animated, send videos instead]).
|
void |
stopAttitudeDataToOSC() |
void |
stopTouchDataToOSC() |
void |
subscribeAnalogEmbedded(int frequency)
EMBEDDED
You can subscribe to the analog input on Tramontana NANO or Tramontana PICO.
|
void |
subscribeAttitude()
Subscribe to Motion sensor (accelerometer).
|
void |
subscribeAttitude(int frequency) |
void |
subscribeAudioJack()
Be notified if the audio jack is inserted or removed.
|
void |
subscribeButtonsEventEmbedded()
EMBEDDED
Listen for buttons event from Tramontana NANO or Tramontana PICO.
|
void |
subscribeDistance()
Subscribe to the distance sensor.
|
void |
subscribeLDREmbedded(int frequency)
EMBEDDED
You can subscribe to the integrated LDR on Tramontana NANO or Tramontana PICO.
|
void |
subscribeMagnetometer()
Subscribe to magnetometer.
|
void |
subscribeOrientation()
Subscribe to orientation change.
|
void |
subscribePowerSource()
Be notified if the power source change.
|
void |
subscribeRxEmbedded()
EMBEDDED
Subscribe RX will make Tramontana NANO or Tramontana PICO act as proxy for incoming messaging coming on the serial port
It is possible to intercept the messages from Processing with the method:
void onEmbeddedRxEvent(String ip,String msg)
{
println("serial message received:"+msg);
}
|
void |
subscribeTouch()
Subscribe to the touch events.
|
void |
subscribeTouch(java.lang.Boolean multitouch) |
void |
subscribeTouchDrag() |
void |
subscribeTouchDrag(java.lang.Boolean multitouch) |
void |
takePicture()
takePicture will take a picture with your camera.
|
void |
takePicture(int camera) |
void |
takePictureWithUI(int camera)
takePictureWithUI will take a picture showing the modal view provided by iOS for taking pictures.
|
void |
transitionColors(float r1,
float g1,
float b1,
float a1,
float r2,
float g2,
float b2,
float a2,
float duration)
Provide two colors and duration.
|
static java.lang.String |
version()
return the version of the Library.
|
public java.lang.String ipAddress
public static final java.lang.String VERSION
public Tramontana(PApplet parent, java.lang.String IP)
public void reconnect()
public void sendMessage(java.lang.String msg)
public void onMessageEvent(java.lang.String msg)
public void setServoEmbedded(int servoIndex, int value)
servoIndex
- will define the index of the servo you want to controlthe
- second parameter is a number between 0 and 180.public void setRelayEmbeddedOff(int relayIndex)
relayIndex
- will define the index of the relay you want to turn OFFpublic void setRelayEmbeddedOn(int relayIndex)
relayIndex
- will define the index of the relay you want to turn ONpublic void sendSerialMessageEmbedded(java.lang.String msg)
relayIndex
- will define the index of the relay you want to controlthe
- second parameter can be 0 (relay off) and 1 (relay on).public void setColorEmbedded(int ledIndex, int red, int green, int blue)
ledIndex
- will define the index of the led you want to controlred
- component.blue
- component.green
- component.public void blinkColorEmbedded(int ledIndex, int red, int green, int blue)
setColorEmbedded
.
ledIndex
- will define the index of the led you want to controlred
- component.blue
- component.green
- component.public void setAllColorEmbedded(int red, int green, int blue)
red
- component.blue
- component.green
- component.public void makeVibrate()
public void setBrightness(float brightness)
public void setColor(int red, int green, int blue, int intensity)
public void setColor(float red, float green, float blue, float intensity)
public void setFlashLight(float onValue)
public void pulseFlashLight(int numberOfPulses, float duration, float intensity)
public void showImage(java.lang.String url)
public void playAudio(java.lang.String url)
public void playVideo(java.lang.String url)
public void takePicture()
(int)
- which camera 0 frontal camera, 1 back camerapublic void takePicture(int camera)
public void takePictureWithUI(int camera)
(int)
- which camera 0 frontal camera, 1 back camerapublic void transitionColors(float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2, float duration)
public void getBatteryLevel()
public void sendAttitudeDataToOSC(float frequency, int port)
public void sendAttitudeDataToOSC(float frequency, int port, java.lang.String ip)
public void sendTouchDataToOSC(int maxNumFingers)
public void sendTouchDataToOSC(int maxNumFingers, int port)
public void sendTouchDataToOSC(int maxNumFingers, int port, java.lang.String ip)
public void stopAttitudeDataToOSC()
public void stopTouchDataToOSC()
public void subscribeDistance()
public void releaseDistance()
public void subscribeTouch()
public void subscribeTouch(java.lang.Boolean multitouch)
public void releaseTouch()
public void subscribeTouchDrag()
public void subscribeTouchDrag(java.lang.Boolean multitouch)
public void releaseTouchDrag()
public void subscribeAttitude()
the
- parameter specify the update frequency in Hz. Keep it low, suggested: 5Hz, default: 1Hz
Test
public void subscribeAttitude(int frequency)
public void releaseAttitude()
public void subscribeAudioJack()
public void releaseAudioJack()
public void subscribePowerSource()
public void releasePowerSource()
public void subscribeMagnetometer()
public void releaseMagnetometer()
public void subscribeOrientation()
public void releaseOrientation()
public void subscribeRxEmbedded()
public void releaseRxEmbedded()
public void subscribeButtonsEventEmbedded()
public void releaseButtonsEventEmbedded()
public void subscribeAnalogEmbedded(int frequency)
public void releaseAnalogEmbedded()
public void subscribeLDREmbedded(int frequency)
public void releaseLDREmbedded()
public static java.lang.String version()
Processing Library tramontana_processing by Pierluigi Dalla Rosa. pierdr(c) 2018