Sending data received on raspberry from webpage to arduino via Bluetooth

1 post / 0 new
Saurav Suman's picture
Offline
Joined: Oct 19, 2017
Sending data received on raspberry from webpage to arduino via Bluetooth
October 19, 2017 - 2:42am

I am working on a small project in which a webpage is hosted on raspberry pi, there are some buttons with pre-defined values (single character). Whenever a user presses a button the data is sent to the pi. 
I need to send that data/character to arduino which is connected to the pi via bluetooth.

Till now i have been able to send data to the arduino from terminal by running a python program which takes raw input and forwards it via sock.send()

import bluetooth

bd_addr = "MAC of Bluetooth" 
port = 1
sock = bluetooth.BluetoothSocket (bluetooth.RFCOMM)
sock.connect((bd_addr,port))

while 1:
        tosend = raw_input()
        if tosend != 'q':
                sock.send(tosend)
        else:
                break

sock.close()

What i need help with is how to read the pressed button's character in a python program form html page and forward it via bluetooth. 

I am using Python 2 
the webpage is hosted using  Lighttpd