hi
I use some example in here
but I have this error
so I need a Install Arduino IDE or how ?
thanks
code
I use some example in here
but I have this error
so I need a Install Arduino IDE or how ?
thanks
code
B4X:
Sub Process_Globals
Public Serial1 As Serial
Private SoftwareSerial1 As SoftwareSerial
Private astream As AsyncStreams
Private leds(1) As Pin
Private timer1 As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
leds(0).Initialize(leds(0).A0, leds(0).MODE_OUTPUT)
SoftwareSerial1.Initialize(9600, 10, 11) 'software serial port on pins 10 and 11
astream.Initialize(SoftwareSerial1.Stream, "astream_NewData", Null)
timer1.Initialize("timer1_Tick", 1000)
timer1.Enabled = True
End Sub
'Arduino: This application was configured To use a bundled Java Runtime Environment but the runtime is missing Or corrupted.
Sub Timer1_Tick
astream.Write("Millis here: ".GetBytes)
astream.Write(NumberFormat(Millis, 0, 0).GetBytes)
astream.Write(Array As Byte(10)) 'end of line character. AsyncStreamsText will cut the message here
End Sub
Sub AStream_NewData (Buffer() As Byte)
For i = 0 To Buffer.Length - 2 Step 2
Dim ledNumber As Byte = Buffer(i)
Dim value As Boolean = Buffer(i + 1) = 1
leds(ledNumber).DigitalWrite(value)
Next
End Sub
#if C
#include <avr/pgmspace.h>
const PROGMEM byte data[] = { //change the data here
1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE,
8, 9, 10, 11, 0xFF, 0xFE
};
B4R::Object beo1;
B4R::Object* getdata(B4R::Object* o) {
return beo1.wrapNumber(pgm_read_byte_near(data + o->toLong()));
}
#end if