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:
Jallib Style Guide · jallib/jallib Wiki · 
GitHub<https://github.com/jallib/jallib/wiki/Jallib-Style-Guide>

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: [email protected] <[email protected]> namens Djibril Sall 
<[email protected]>
Verzonden: woensdag 24 februari 2021 17:26
Aan: [email protected] <[email protected]>
Onderwerp: [jallib] Hc-06


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!!

--
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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CALqKeO7y17QbbezKWApJm1kDmH4P46B_nDGaaJuDv%2BS2SuT%3Dig%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CALqKeO7y17QbbezKWApJm1kDmH4P46B_nDGaaJuDv%2BS2SuT%3Dig%40mail.gmail.com?utm_medium=email&utm_source=footer>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/AM0PR07MB6241D4E84AAA2EF87D702611E69F9%40AM0PR07MB6241.eurprd07.prod.outlook.com.

Reply via email to