B4J Question For use B4R Do I need a Install Arduino IDE?

naifnas

Active Member
Licensed User
hi
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
 

Attachments

  • 1.png
    1.png
    45.1 KB · Views: 153
  • WhatsApp Image 2020-03-10 at 15.35.03.jpeg
    WhatsApp Image 2020-03-10 at 15.35.03.jpeg
    137.3 KB · Views: 137

naifnas

Active Member
Licensed User
1. You are posting in the wrong place.
2. The instructions are very clear: https://www.b4x.com/b4r.html
3. You don't need to buy anything. Arduino IDE is free.
thank you
sorry for wrong but i asked example about B4R
and I already study this : https://www.b4x.com/b4r.html
yes very good it
Clear explanation supported by graphics

and I try download this he want I pay
Arduino IDE: Arduino 1.8.10
can help me give me link free ?
thanks and I am sorry for bother us
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
Click in "Just Download" instead of "Contribute and Download"
 
Upvote 0
Top