Notes![what is notes.io? What is notes.io?](/theme/images/whatisnotesio.png)
![]() ![]() Notes - notes.io |
import roslib
import rospy
import os
import time
import serial
from std_msgs.msg import String
from std_msgs.msg import Bool
class BTreceiver():
def stateCallback(self, data):
self.state = data.data;
def __init__(self):
self.state = ""
# setup
rospy.init_node("android_bluetooth_node")
#publisher
self.pub = rospy.Publisher('/nexus_message', String, queue_size=1)
#self.debugpub = rospy.Publisher('BTdebug', String, queue_size=1)
#subscriber
self.sub = rospy.Subscriber("/current_task", String, self.stateCallback)
rate = rospy.Rate(10)
# Setup Bluetooth
os.system("sudo sdptool add --channel=16 SP");
os.system("sudo rfcomm listen /dev/rfcomm3 16 &");
print("YOU HAVE 20 SECONDS TO CONNECT THE APP!!!!!!!!!")
time.sleep(20) ##
os.system("sudo chmod 777 /dev/rfcomm3")
# Serial port setup
ser = serial.Serial()
ser.port = "/dev/rfcomm3" # may be called something different
ser.baudrate = 9600 # may be different
ser.timeout = 0 # may be different
ser.open()
rate = rospy.Rate(8) # 10hz
android_data = ""
oldData = ""
#self.debugpub.publish('line 50:')
while(ser.isOpen()):
if oldData != self.state:
ser.write(self.state)
oldData = self.state
if ser.inWaiting>0:
btMessage = ser.read()
#self.debugpub.publish(btMessage)
# self.pub.publish(self.state)
if btMessage == "$":
self.pub.publish(android_data)
print android_data
android_data = "";
else:
android_data = android_data+btMessage;
rate.sleep()
btMessage = "Lost Bluetooth Connection!! HELP!!"
self.pub.publish(btMessage)
rospy.spin();
if __name__ == '__main__':
try:
BTreceiver()
except rospy.ROSInterruptException:
rospy.loginfo("exception")
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team