Hc-06

31 views
Skip to first unread message

Djibril Sall

unread,
Feb 24, 2021, 12:41:18 PM2/24/21
to jal...@googlegroups.com

Hi Rob!
I'm sorry for late!
-- include library 16f877a_bert and serial_hardware included in 16f877a_bert
Include 16f877a_bert
-- speed is 9600 baud

Serial_hw_baudrate

-- define rs232 communication
usart_hw_serial

-- define the pins
pin_a0_direction = output

-- declaration the variable
var byte x
forever loop
-- send RCREG to the serial port RCREG is a tampon
serial_ hw_data = RCREG

-- look if the byte is available and RCIF is Serial_hw_available
if RCIF then
x = RCREG

-- naw you use the androide application with app inventor and don't forget hc-06 module is slave
          if x == "1" then
          serial_hw_write(x)
          pin_a0 = high
end if
          if x == "0" then
           serial_hw_write(x)
           pin_a0 = low
end if
end if
end loop

Thanks I'm going to wait your answer!
And I want, you explain me how to build library and command please!!

Rob CJ

unread,
Feb 24, 2021, 1:03:05 PM2/24/21
to jal...@googlegroups.com
Hi Djibril,

Thanks for the example but I do not quite understand how this works for the Module. It seems as if you use it as default without any change. A library must offer functions to control the module and so the user can change the default behavior. These functions must make life easier for the user. If you start with JAL (and programming) I would not recommend to make a library since you are stil in the learning phase and it is better to see how others have made JAL libraries before making your own.

On Github you find some information about the style guide of any JAL Library:

To give you a part of an example of what a user program would look like if you would have a library for the HC-06, you find the sample program that I made for my libary below. In this example I test all the library features (so it is not a real application).


-- Sample program (just a piece of it, not the whole program)
var byte character
var bit  all_ok

include bt_hc06 -- The HC-06 library

print_string(serial_hw2_data,"Sample program for the Bluetooth HC-06 Module.\r\n")

-- Initialize the module. This is the same as reset.
bt_hc06_init()

-- Let's see if the module is connected.
all_ok = bt_hc06_alive()  
-- Change the pincode.
all_ok = all_ok & bt_hc06_set_device_pin("1111")
all_ok = all_ok & bt_hc06_set_device_name("My HC-06")

-- Change the baudrate to something faster.
all_ok = all_ok &  bt_hc06_set_baudrate(BT_HC_BAUDRATE_19200)

if all_ok then
   print_string(serial_hw2_data,"Module initialzed and alive.\r\n\r\n")
else
   print_string(serial_hw2_data,"Error initializing module.\r\n\r\n")
end if

print_string(serial_hw2_data,"Checking for data.\r\n")

-- We make a Bluetool (wireless) COM Port.
forever loop

  -- If data is received from the Bluetooth Module send it to the USART.
  if bt_hc06_data_available() then
     serial_hw2_data = bt_hc06_data
   end if
 
  -- If data was received from the USART send it to the Bluetooth Module.
  if serial_hw2_data_available() then
     bt_hc06_data = serial_hw2_data
  end if

end loop


Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Djibril Sall <saidou...@gmail.com>
Verzonden: woensdag 24 februari 2021 17:26
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: [jallib] Hc-06
 
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CALqKeO7y17QbbezKWApJm1kDmH4P46B_nDGaaJuDv%2BS2SuT%3Dig%40mail.gmail.com.

Djibril Sall

unread,
Feb 24, 2021, 3:35:08 PM2/24/21
to jal...@googlegroups.com

Thank you for the advice and i will follow  the method you told me!
But the program that you indicated to me below is to configure the Bluetooth module, isn't it?
I will tell you what I  did for the configuration of my module, I configured it with arduino uno and the program I sent to you, I had it written in jal edit using commands from libraries Bert and it worked well!
So if you have a library like you just told me from the hc-06 module, please send it to me!

vasi vasi

unread,
Feb 24, 2021, 6:41:27 PM2/24/21
to jal...@googlegroups.com
Well Rob, he has the right to do whatever library he wants in Jal language, for whatever reason. The fact that his library does not qualify for jallib project, that is entirely a different matter. 



--
Vasi

vsurducan

unread,
Feb 25, 2021, 1:06:50 AM2/25/21
to jal...@googlegroups.com
Hi Djibril,

The library which may help Rob to write his jallib compatible library  is called "bt_hc06.jal" from Bert van Dam jal pack.
Rob perhaps did not know this library version. He is newer at jallib (and fortunately very enthusiastic). :)
Bert wrote his own library style which is not compatible with jallib style nor with actual PIC definition style, however both libraries can be used with the actual jal compiler version, and both styles can create huge problems as well (I'm just experiencing one right now)...

thank you, keep your good work

--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.

Rob CJ

unread,
Feb 25, 2021, 4:43:52 AM2/25/21
to jal...@googlegroups.com
Hi Vasi,

Of course anybody can create the library that they want to create. 

If, however, a library becomes part of a Jallib release, it has to comply with the style guide, otherwise the library  will not pass the validation check. Any JAL file that is part of a Jallib release and that does pass the validation check will create a build failure.

I think that is a good thing about JAL, some minimal requirements for the way you create the code.

When I create a library I sometimes look for a version made for Arduino for inspiration. I immediately see that there are no coding rules so libraries vary greatly in quality and readability.

Kind regards,

Rob



Van: jal...@googlegroups.com <jal...@googlegroups.com> namens vasi vasi <fun...@gmail.com>
Verzonden: donderdag 25 februari 2021 00:40
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: Re: [jallib] Hc-06
 

Rob CJ

unread,
Feb 25, 2021, 12:55:38 PM2/25/21
to jal...@googlegroups.com
Hi Vsruducan,

The library is bt_hc_06.jal is not from Bert van Dam, it is the library I am creating 🙂.

I checked Bert's library if there was one related to the HC-06 but could not find one.

As I said, I will add it to Jallib if I am able to test it with a HC-06 module.

@Djibril. If you want to use it when it is ready you need to switch from Bert van Dam to Jallib and download it from the JAL download site. It will then be in the latest 'bee' package.

Kind regards,

Rob




Van: jal...@googlegroups.com <jal...@googlegroups.com> namens vsurducan <vsur...@gmail.com>
Verzonden: donderdag 25 februari 2021 07:06

Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: Re: [jallib] Hc-06

vsurducan

unread,
Feb 26, 2021, 12:37:20 AM2/26/21
to jal...@googlegroups.com
:)  Hopefully you do not want a full duplex...
Don't rush, reliable communication using BLE it is not easy. As well using USB and the existing library....

Reply all
Reply to author
Forward
0 new messages