ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
is touched, B4RSerializator converts a
two-byte command array to bytes and
sends it over the astream output data
pipe (socket.OutputStream). Looking
back at the B4R code, we see that the
n PHONESHOT 3. The blue LED graphic tells us
that the D0 I/O pin of the WEMOS D1 Mini is
logically high, or ON in the OFF state.
The status message returned from the WEMOS Mini
server consists of the button touched and the status of the
associated Mini output pin. The button touched is decoded
by B4RSerializator as data(0), and the status of the output
pin is decoded by B4RSerializator as data(1). The blue
D1 Mini application is looking for commands S0, S1, and
S2 in array form.
When the Mini server receives our button command
string, it toggles the associated I/O bit and returns a status
message to the client iPhone. The iPhone application
processes the incoming status message using the Astream_
NewData subroutine:
Private;Sub;Astream_NewData;(Buffer();As;Byte)
data;=;ser.ConvertBytesToArray(Buffer)
Select;data(0)
Case;“S0”
If;data(1);=;True;Then
imgvLedD0.Bitmap;=;(LoadBitmap(File.
DirAssets,;“blueledon.png”))
Else
imgvLedD0.Bitmap;=;(LoadBitmap(File.
DirAssets,;“blueledoff.png”))
End;If
Case;“S1”
If;data(1);=;True;Then
imgvLedD1.Bitmap;=;(LoadBitmap(File.
DirAssets,;“blueledon.png”))
Else
imgvLedD1.Bitmap;=;(LoadBitmap(File.
DirAssets,;“blueledoff.png”))
End;If
Case;“S2”
If;data(1);=;True;Then
imgvLedD2.Bitmap;=;(LoadBitmap(File.
DirAssets,;“blueledon.png”))
Else
imgvLedD2.Bitmap;=;(LoadBitmap(File.
DirAssets,;“blueledoff.png”))
End;If
End;Select
End;Sub
I Leave You
Illuminated
I touched button S0 and
was presented the iPhone
view you see in Phoneshot 3. I checked the voltage at pin
D0 of the Mini and it was indeed at + 3.3V.
B4R provides access to all of the WEMOS D1 Mini’s
tricks, while B4I puts the compute power of an iPhone and
iPad into your Design Cycle. NV
TS-4900
Computer on Module
i.MX6 ARM CPU
WiFi & Bluetooth
Solo or Quad Core
2 GB DDR3 RAM
B4R B4I
Anywhere Software
www.b4x.com
www.embeddedARM.com
Actual Size
February 2018 57