Code Monkey home page Code Monkey logo

Comments (20)

aryan2013 avatar aryan2013 commented on June 27, 2024

Ok, i followed your reply in #9 , and followed your instruction,,

i am now successful.

well, few thing not understood, why other subscribe report in debug serial terminal after 3 subscribe and one publish in your demo code. See picture

espduino

from espduino.

tuanpmt avatar tuanpmt commented on June 27, 2024

esp_mqtt using a ringbuffer to queue subscribe and publish message, first message is confirm queue to buffer success, after send msg to server, and receive sub ack, you will see subscribe message success

from espduino.

aryan2013 avatar aryan2013 commented on June 27, 2024

Ok i got it...

mqtt.subscribe("/topic/0"); //or mqtt.subscribe("topic"); /with qos = 0/
mqtt.subscribe("/topic/1");
mqtt.subscribe("/topic/2");
mqtt.publish("/topic/0", "data0");

three subscribe, so they initially queued and then i found three subscribe successful.

Then what about published topic mqtt.publish("/topic/0", "data0");???

also, this topic was subscribed, so it should also returned back to same client.

So, terminal should show one publish confirmation/ack and one receipt of subscribed message. But, there is nothing like that in terminal.

one more query: how to publish and subscribe for QoS2?

from espduino.

aryan2013 avatar aryan2013 commented on June 27, 2024

void subscribe(const char* topic, uint8_t qos); [inside mqtt.h file]

---- gave me idea to use QoS.

But tuan PM,

publish is not working. I am getting response after execution of mqtt.publish("uptime", "test"); as below:-

CMD: 7, cb: 0, ret: 0, argc: 5
Arg[0], len: 4:B8-34-FF-3F-

Arg[1], len: 8:75-70-74-69-6D-65-00-00-

Arg[2], len: 4:74-65-73-74-

Arg[3], len: 4:00-00-00-00-

Arg[4], len: 4:00-00-00-00-

Read CRC: 667C, calculated crc: 667C

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

Hello,

When I upload software to esp8266 I get an error that is below. Please help me !!!.

pi@raspberrypi /usr/share/arduino/libraries/espduino $ sudo esp8266/tools/esptool.py -p /dev/ttyUSB0 write_flash 0x00000 esp8266/release/0x00000.bin 0x40000 esp8266/release/0x40000.bin
Could not find platform dependent libraries
Consider setting $PYTHONHOME to [:]
Traceback (most recent call last):
File "esp8266/tools/esptool.py", line 22, in
import serial
ImportError: No module named serial

from espduino.

bigpaulie avatar bigpaulie commented on June 27, 2024

@ibrahimisim stop posting and just install the pySerial library . Just run sudo pip install pyserial or sudo apt-get install python-serial

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

pi@raspberrypi /usr/share/arduino/libraries/espduino/esp8266/tools $ sudo apt-get install python-serial
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-serial is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 34 not upgraded.

from espduino.

bigpaulie avatar bigpaulie commented on June 27, 2024

@ibrahimisim if you type : echo $PYTHONPATH , does it return something ?

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

pi@raspberrypi /usr/share/arduino/libraries/espduino/esp8266/tools $ echo $PYTHONPATH

pi@raspberrypi /usr/share/arduino/libraries/espduino/esp8266/tools $

I saw nothing

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

pi@raspberrypi /usr/share/arduino/libraries/espduino/esp8266/tools $ sudo apt-get install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
python is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 34 not upgraded.
pi@raspberrypi /usr/share/arduino/libraries/espduino/esp8266/tools $

from espduino.

bigpaulie avatar bigpaulie commented on June 27, 2024

@ibrahimisim ,OK no need to worry. just type whereis python
it should return something like :
python: /usr/bin/python /usr/bin/python2.7 /usr/bin/python2.6 /etc/python /etc/python2.7 /etc/python2.6 /usr/lib/python2.7 /usr/lib/python2.6 /usr/bin/X11/python /usr/bin/X11/python2.7 /usr/bin/X11/python2.6 /usr/local/lib/python2.7 /usr/local/lib/python2.6 /usr/include/python2.7 /usr/include/python2.6 /usr/share/python

just export the variables like any other environment variable
nano ~/.bashrc

export PYTHONHOME=/usr/bin/python
export PYTHONPATH=/usr/lib/python2.7

it should work

you can do this also in /etc/rc.local above the "exit 0" line
if you write it in rc.local it will be available system wide in .bashrc it will only be available for "pi" user

***EDIT:

Forgot to say, if you export the variables in the .bashrc file you need to close the terminal and reopen it or just type source ~/.bashrc

if you add the variables in /etc/rc.local you need to reboot

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

pi@raspberrypi /usr/share/arduino/libraries/espduino $ cd /etc/rc.local
-bash: cd: /etc/rc.local: Not a directory
pi@raspberrypi /usr/share/arduino/libraries/espduino $

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

pi@raspberrypi /usr/share/arduino/libraries/espduino $ echo $PYTHONPATH
/usr/lib/python2.7
pi@raspberrypi /usr/share/arduino/libraries/espduino $

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

pi@raspberrypi /usr/share/arduino/libraries/espduino $ esp8266/tools/esptool.py -p /dev/ttyUSB0 write_flash 0x00000 esp8266/release/0x00000.bin 0x40000 esp8266/release/0x40000.bin
Traceback (most recent call last):
File "esp8266/tools/esptool.py", line 22, in
import serial
ImportError: No module named serial
pi@raspberrypi /usr/share/arduino/libraries/espduino $

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

pi@raspberrypi /usr/share/arduino/libraries/espduino $ esp8266/tools/esptool.py -p /dev/ttyUSB0 write_flash 0x00000 esp8266/release/0x00000.bin 0x40000 esp8266/release/0x40000.bin
File "/usr/lib/python3.2/site.py", line 165
file = sys.stderr)
^
SyntaxError: invalid syntax
pi@raspberrypi /usr/share/arduino/libraries/espduino $

from espduino.

bigpaulie avatar bigpaulie commented on June 27, 2024

@ibrahimisim , you are not paying attention .
/etc/rc.local is not a directory, to edit it type : sudo nano /etc/rc.local

these settings should work fine on Raspberry Pi (Raspbian) assuming that you have python 2.7
export PYTHONHOME=/usr/bin/python
export PYTHONPATH=/usr/lib/python2.7

I've tested these settings and all is well .

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

I did like as you say but I get an error below.

pi@raspberrypi /usr/share/arduino/libraries/espduino $ esp8266/tools/esptool.py -p /dev/ttyUSB0 write_flash 0x00000 esp8266/release/0x00000.bin 0x40000 esp8266/ release/0x40000.bin
Traceback (most recent call last):
File "esp8266/tools/esptool.py", line 22, in
import serial
ImportError: No module named serial

pi@raspberrypi /usr/share/arduino/libraries/espduino $ echo $PYTHONPATH
/usr/lib/python2.7
pi@raspberrypi /usr/share/arduino/libraries/espduino $

from espduino.

bigpaulie avatar bigpaulie commented on June 27, 2024

You have Python 3.x ... just use 2.7 and it will be fine, now .. it's very late and I will not be able to respond anymore also this is not the right place to do this. uninstall your python 3.x, install python 2.7, reinstall your serial library it should work ... @tuanpmt sorry for the big mess !

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

Thanks a lot for your quick reply. I will try and inform you tomorrow. Good night.

from espduino.

ibrahimisim avatar ibrahimisim commented on June 27, 2024

I can not remove python.

pi@raspberrypi ~ $ sudo apt-get remove python python2.7 python3 python3.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
blt gir1.2-freedesktop gir1.2-gst-plugins-base-0.10 gir1.2-gstreamer-0.10 libatlas3-base
libavahi-client-dev libavahi-common-dev libblas3 libelfg0 libgfortran3 libglib2.0-bin
liblapack3 libmad0 libmikmod2 libpcre3-dev libpcrecpp0 libportmidi0 libpulse-mainloop-glib0
libqt4-dbus libqt4-declarative libqt4-designer libqt4-help libqt4-script libqt4-scripttools
libqt4-sql libqt4-sql-mysql libqt4-svg libqt4-test libqt4-xmlpatterns libqtwebkit4
libsdl-image1.2 libsdl-mixer1.2 libsdl-ttf2.0-0 libsdl1.2debian libsmpeg0 libvorbisfile3
python3-minimal python3.2-minimal qdbus
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
doxygen-latex gconf2 gdb gksu gstreamer0.10-gconf gstreamer0.10-plugins-good idle
idle-python2.7 idle-python3.2 idle3 jackd2 libgksu2-0 libglib2.0-dev
libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libpulse-dev libpython2.7
libpython3.2 python python-central python-dbus python-dev python-gi python-numpy
python-picamera python-pifacecommon python-pifacedigitalio python-pip python-pkg-resources
python-pygame python-qt4 python-qt4-dev python-rpi.gpio python-serial python-setuptools
python-sip python-sip-dev python-smbus python-support python-tk python2.7 python2.7-dev
python3 python3-dev python3-numpy python3-picamera python3-pifacecommon
python3-pifacedigital-scratch-handler python3-pifacedigitalio python3-pygame
python3-rpi.gpio python3-serial python3-tk python3.2 python3.2-dev texlive-extra-utils
0 upgraded, 0 newly installed, 56 to remove and 34 not upgraded.
After this operation, 199 MB disk space will be freed.
Do you want to continue [Y/n]? Y
dpkg: warning: files list file for package 'libpcre3-dev:armhf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgcrypt11:armhf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavformat-dev' missing; assuming package has no fi les currently installed
dpkg: unrecoverable fatal error, aborting:
files list file for package 'libavutil-dev' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

from espduino.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.