{"id":3365,"date":"2023-02-25T06:08:11","date_gmt":"2023-02-25T14:08:11","guid":{"rendered":"https:\/\/www.donluc.com\/?p=3365"},"modified":"2023-02-25T06:08:11","modified_gmt":"2023-02-25T14:08:11","slug":"project-26-radio-frequency-b4j-mk08","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=3365","title":{"rendered":"Project #26 &#8211; Radio Frequency &#8211; B4J &#8211; Mk08"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3365-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #RadioFrequency #B4J #Bluetooth #SparkFunThingPlusESP32WROOM #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01a.png\" alt=\"B4J\" width=\"720\" height=\"490\" class=\"alignnone size-full wp-image-3367\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01a-300x204.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01b.png\" alt=\"B4J\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3368\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01c.png\" alt=\"B4J\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-3369\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2023\/02\/DL2301Mk01c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>B4J<\/strong><\/p>\n<p>RAD development tool for cross platform desktop, server and IoT solutions. B4J is a 100% free development tool for desktop, server and IoT solutions. With B4J you can easily create desktop applications, console programs and server solutions. B4J apps can run on Windows, Mac, Linux and ARM boards such as Raspberry Pi. The compiled apps are standalone, without any external dependencies.<\/p>\n<p><strong>DL2301Mk01<\/strong><\/p>\n<p>1 x SparkFun Thing Plus &#8211; ESP32 WROOM<br \/>\n1 x Lithium Ion Battery &#8211; 1 Ah<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>SparkFun Thing Plus &#8211; ESP32 WROOM<\/strong><\/p>\n<p>TX0 &#8211; Digital 26<br \/>\nTR0 &#8211; Digital 27<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DL2301Mk01p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/* ***** Don Luc Electronics \u00a9 *****\r\nSoftware Version Information\r\nProject #26 - Radio Frequency - B4J - Mk08\r\n26-08\r\nDL2301Mk01p.ino\r\n1 x SparkFun Thing Plus - ESP32 WROOM\r\n1 x GPS Receiver - GP-20U7 (56 Channel)\r\n1 x Lithium Ion Battery - 1 Ah\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ Bluetooth Serial (ESP32SPP)\r\n#include &quot;BluetoothSerial.h&quot; \r\n\r\n\/\/ Bluetooth Serial (ESP32SPP)\r\nBluetoothSerial SerialBT;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;26-08&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Bluetooth Serial (ESP32SPP)\r\n  isBluetooth();\r\n\r\n}\r\n<\/pre>\n<p><strong>getBluetooth.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Bluetooth\r\n\/\/ isBluetooth\r\nvoid isBluetooth() {\r\n\r\n  \/\/ Input\r\n  byte inputFromOtherSide;\r\n  \r\n  \/\/ Bluetooth Serial (ESP32SPP)\r\n  if (SerialBT.available()) {\r\n\r\n    \/\/ Input Read\r\n    inputFromOtherSide = SerialBT.read();\r\n    \/\/ Write\r\n    SerialBT.write(inputFromOtherSide);\r\n\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup()\r\n{\r\n\r\n  \/\/ Bluetooth Serial (ESP32SPP)\r\n  SerialBT.begin(&quot;DLE&quot;);\r\n  \r\n  \/\/ Delay\r\n  delay(1000);\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>B4J &#8211; Bluetooth<\/strong><\/p>\n<p><strong>Bluetooth.b4j<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n#Region  Project Attributes \r\n\t\r\n\t&#039; Form Width and Form Height\r\n\t#MainFormWidth: 600\r\n\t#MainFormHeight: 400 \r\n\t\r\n#End Region\r\n\r\nSub Process_Globals\r\n\t\r\n\t&#039;Java OpenJDK 11\r\n\tPrivate fx As JFX\r\n\t&#039; MainForm =&gt; Form\r\n\tPrivate MainForm As Form\r\n\t&#039; Button\r\n\tPrivate btnConnect As Button\r\n\tPrivate btnSearch As Button\r\n\tPrivate btnSend As Button\r\n\t&#039; List View\r\n\tPrivate ListView1 As ListView\r\n\t&#039; Text Field\r\n\tPrivate txtInput As TextField\r\n\t&#039; Text Area\r\n\tPrivate txtLog As TextArea\r\n\t\r\n\t&#039; Bluetooth\r\n\tPrivate bt As Bluetooth\r\n\t&#039; Async Streams\r\n\tPrivate astream As AsyncStreams\r\n\t&#039; Boolean\r\n\tPrivate connected As Boolean\r\n\tPrivate searchingForDevices As Boolean\r\n\t&#039; Bluetooth Connection\r\n\tPrivate currentConnection As BluetoothConnection\r\n\t\r\n\t&#039; Map\r\n\tPrivate foundDevices As Map\r\n\t&#039; Button\r\n\tPrivate btnDisconnect As Button\r\n\t&#039; Label\r\n\tPrivate lblConnectionState As Label\r\n\tPrivate lblSearchState As Label\r\n\t&#039; Image View\r\n\tPrivate ImageView1 As ImageView\r\n\t\r\nEnd Sub\r\n\r\nSub AppStart (Form1 As Form, Args() As String)\r\n\t\r\n\t&#039; App Start =&gt; MainForm = Form1\r\n\tMainForm = Form1\r\n\tMainForm.SetFormStyle(&quot;UNIFIED&quot;)\r\n\t&#039; Load the layout file.\r\n\tMainForm.RootPane.LoadLayout(&quot;1&quot;) \r\n\t&#039; Show\r\n\tMainForm.Show\r\n\t&#039; Bluetooth\r\n\tbt.Initialize(&quot;bt&quot;)\r\n\tfoundDevices.Initialize\r\n\tIf bt.IsEnabled Then\r\n\t\tbt.Listen\r\n\tEnd If\r\n\t&#039; Update State\r\n\tUpdateState\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub UpdateState\r\n\t\r\n\t&#039; Update State\r\n\tIf bt.IsEnabled = False Then\r\n\t\t\r\n\t\t&#039; No Bluetooth\r\n\t\tlblSearchState.Text = &quot;Bluetooth not available&quot;\r\n\t\tFor Each n As Node In MainForm.RootPane\r\n\t\t\tn.Enabled = False\r\n\t\tNext\r\n\t\t\r\n\tElse\r\n\t\t\r\n\t\t&#039; Bluetooth\r\n\t\t&#039; Button\r\n\t\tbtnSearch.Enabled = Not(searchingForDevices)\r\n\t\tbtnConnect.Enabled = Not(connected) And ListView1.SelectedIndex &gt; -1\r\n\t\ttxtInput.Enabled = connected\r\n\t\tbtnSend.Enabled = connected\r\n\t\tbtnDisconnect.Enabled = connected\r\n\t\t\r\n\t\t&#039; State =&gt; Connected or Disconnected\r\n\t\tDim state As String\r\n\t\tIf connected Then \r\n\t\t\tstate = &quot;Connected: &quot; &amp; currentConnection.Name \r\n\t\tElse \r\n\t\t\tstate = &quot;Disconnected&quot;\r\n\t\tEnd If\r\n\t\t&#039; Label\r\n\t\tlblConnectionState.Text = state\r\n\t\tlblSearchState.Text = &quot;Searching...&quot;\r\n\t\tlblSearchState.Visible = searchingForDevices\r\n\t\t\r\n\tEnd If\r\n\t\r\nEnd Sub\r\n\r\n\r\nPrivate Sub btnSearch_Action\r\n\t\r\n\t&#039; Button\r\n\t&#039; Search Boolean\r\n\tDim res As Boolean = bt.StartDiscovery\r\n\tIf res Then\r\n\t\t\r\n\t\t&#039; Searching For Devices\r\n\t\tsearchingForDevices = True\r\n\t\t&#039; List View\r\n\t\tListView1.Items.Clear\r\n\t\t&#039; Update State\r\n\t\tUpdateState\r\n\t\t\r\n\tElse\r\n\t\t\r\n\t\t&#039; Error\r\n\t\tLog(&quot;Error starting discovery&quot;)\r\n\t\t\r\n\tEnd If\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub bt_DeviceFound (Name As String, MacAddress As String)\r\n\t\r\n\t&#039; Button\r\n\t&#039; Device Found =&gt; Description\r\n\tDim description As String = Name &amp; &quot;: &quot; &amp; MacAddress\r\n\t&#039; List View\r\n\tListView1.Items.Add(description)\r\n\t&#039; Found Devices\r\n\tfoundDevices.Put(description, MacAddress)\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub bt_DiscoveryFinished\r\n\t\r\n\t&#039; Button\r\n\t&#039; Discovery Finished\r\n\tsearchingForDevices = False\r\n\t&#039; Update State\r\n\tUpdateState\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub btnConnect_Action\r\n\t\r\n\t&#039; Button\r\n\t&#039; Connect\r\n\tDim address As String = foundDevices.Get(ListView1.SelectedItem)\r\n\t&#039; Bluetooth\r\n\tbt.Connect(address)\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub bt_Connected (Success As Boolean, connection As BluetoothConnection)\r\n\t\r\n\t&#039; Button\r\n\tLog($&quot;Connected, success=${Success}&quot;$)\r\n\t&#039; Success\r\n\tIf Success Then\r\n\t\t\r\n\t\t&#039; Connection\r\n\t\tcurrentConnection = connection\r\n\t\tconnected = True\r\n\t\t&#039; AStream\r\n\t\tIf astream.IsInitialized Then astream.Close\r\n\t\tastream.InitializePrefix(connection.InputStream, True, connection.OutputStream, &quot;AStream&quot;)\r\n\t\t\r\n\tEnd If\r\n\t&#039; Bluetooth Listen\r\n\tbt.Listen\r\n\t&#039; Update State\r\n\tUpdateState\r\n\t\r\nEnd Sub\r\n\r\nSub AStream_NewData (Buffer() As Byte)\r\n\t\r\n\t&#039; AStream New Data\r\n\t&#039; You =&gt; Arduino\r\n\tLogMessage(&quot;You&quot;, BytesToString(Buffer, 0, Buffer.Length, &quot;UTF8&quot;))\r\n\t\r\nEnd Sub\r\n\r\n\r\nSub AStream_Error\r\n\t\r\n\t&#039; AStream Error\r\n\tconnected = False\r\n\t&#039; Update State\r\n\tUpdateState\r\n\t\r\nEnd Sub\r\n\r\nSub AStream_Terminated\r\n\t\r\n\t&#039; AStream Terminated\r\n\tAStream_Error\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub txtInput_Action\r\n\t\r\n\t&#039; Button Send\r\n\tbtnSend_Action\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub btnSend_Action\r\n\t\r\n\t&#039; Button Send\r\n\tIf txtInput.Text.Length &gt; 0 Then\r\n\t\t\r\n\t\t&#039; AStream\r\n\t\t&#039; Me =&gt; B4J\r\n\t\tLogMessage(&quot;Me&quot;, txtInput.Text)\r\n\t\t&#039; AStream Write\r\n\t\tastream.Write(txtInput.Text.GetBytes(&quot;utf8&quot;))\r\n\t\ttxtInput.Text = &quot;&quot;\r\n\t\t\r\n\tEnd If\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub LogMessage(From As String, Msg As String)\r\n\t\r\n\t&#039; Log Message\r\n\ttxtLog.Text = txtLog.Text &amp; From &amp; &quot;: &quot; &amp; Msg &amp; CRLF\r\n\ttxtLog.SetSelection(txtLog.Text.Length, txtLog.Text.Length)\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub ListView1_SelectedIndexChanged(Index As Int)\r\n\t\r\n\t&#039; Update State\r\n\tUpdateState\r\n\t\r\nEnd Sub\r\n\r\nPrivate Sub btnDisconnect_Action\r\n\t\r\n\t&#039; Bluetooth Disconnect\r\n\tcurrentConnection.Disconnect\r\n\t&#039; AStream Close\r\n\tIf astream.IsInitialized Then astream.Close\r\n\tconnected = False\r\n\t&#039; Update State\r\n\tUpdateState\r\n\t\r\nEnd Sub\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Technology Experience<\/strong><\/p>\n<ul>\n<li>Programming Language<\/li>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Wireless (Radio Frequency, Bluetooth, WiFi, Etc&#8230;)<\/li>\n<li>Robotics<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Machine Learning<\/li>\n<li>RTOS<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<\/ul>\n<p><strong>Instructor, E-Mentor, STEAM, and Arts-Based Training<\/strong><\/p>\n<ul>\n<li>Programming Language<\/li>\n<li>IoT<\/li>\n<li>PIC Microcontrollers<\/li>\n<li>Arduino<\/li>\n<li>Raspberry Pi<\/li>\n<li>Espressif<\/li>\n<li>Robotics<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>Luc Paquin \u2013 Curriculum Vitae &#8211; 2022<\/strong><br \/>\nhttps:\/\/www.donluc.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/@thesass2063<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #RadioFrequency #B4J #Bluetooth #SparkFunThingPlusESP32WROOM #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; B4J RAD development tool for cross platform desktop, server and IoT solutions. B4J is a 100% free development tool for desktop, server and IoT solutions. With B4J you can easily create desktop applications, console programs and server &#8230; <a title=\"Project #26 &#8211; Radio Frequency &#8211; B4J &#8211; Mk08\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=3365\" aria-label=\"Read more about Project #26 &#8211; Radio Frequency &#8211; B4J &#8211; Mk08\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[247,50,49,38,59,5,58,10,43],"tags":[6,270,92,242,102,4,19,24,9,27,264,109,33,34],"class_list":["post-3365","post","type-post","status-publish","format-standard","hentry","category-radio-frequency","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-microcontrollers","category-arduino-programming","category-projects","category-sparkfun","tag-arduino","tag-b4j","tag-battery","tag-bluetooth","tag-components","tag-consultant","tag-electronics","tag-microcontroller","tag-programming","tag-projects-2","tag-radio-frequency","tag-sparkfun","tag-technology","tag-video-blog"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3365"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3365\/revisions"}],"predecessor-version":[{"id":4235,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/3365\/revisions\/4235"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}