Code Monkey home page Code Monkey logo

ofxserial's Introduction

ofxSerial

Description

A cross-platform serial addon for openFrameworks wrapping the Serial Communication Library.

Features

  • Full Port configuration via SerialDevice
    • baud rate
    • data bits
    • parity
    • stop bits
  • Full Flow Control
    • CTS get / set
    • DSR get / set
    • RI get / set
    • CD get / set
  • Read/write blocking control via custom timeouts.
  • Event-driven serial via BufferedSerial class.
  • Packet-based serial system with byte stuffing via PacketSerialDevice
    • SLIP, COBS and others packet encoding supported.
  • Cross-platform compatibility.
    • Tested on:
      • OSX
      • Windows Visual Studio
      • Windows Codeblocks / MinGW / MSYS
      • Linux
  • Robust Cross-platform port listing.
  • Arduino Examples for sanity testing.

Required Addons

  • ofxPoco (included in openFrameworks)
  • ofxIO

Getting Started

To get started, generate the example project files using the openFrameworks Project Generator.

Documentation

API documentation can be found here.

Build Status

Linux, macOS Build Status

Visual Studio, MSYS Build status

Compatibility

The stable branch of this repository is meant to be compatible with the openFrameworks stable branch, which corresponds to the latest official openFrameworks release.

The master branch of this repository is meant to be compatible with the openFrameworks master branch.

Some past openFrameworks releases are supported via tagged versions, but only stable and master branches are actively supported.

Versioning

This project uses Semantic Versioning, although strict adherence will only come into effect at version 1.0.0.

Licensing

See LICENSE.md.

Contributing

Check out the Help Wanted tag in the issues section for specific ideas or propose your own new ideas.

Pull Requests are always welcome, so if you make any improvements please feel free to float them back upstream :)

  1. Fork this repository.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Add some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create new Pull Request.

ofxserial's People

Contributors

avilleret avatar bakercp avatar dasoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ofxserial's Issues

AbstractTypes.h not found

Compiling the Basic Example under OSX results in the following error:
/Users/xxx/Documents/prj/of_v0.8.0_osx_release/addons/ofxSerial/libs/ofxSerial/include/ofx/IO/SerialDevice.h:32:10: 'ofx/IO/AbstractTypes.h' file not found

"COMx does not exist" codeblocks and windows 8

device.setup(devicesInfo[x], 9600) throws an exception in codeblocks 12 & windows 8: Exception: Specified port, COMx, does not exist.

The port does exist, as it's listed in the previous listDevices() call. Is this a codeblocks issue? I will continue googling.

Send & receive

Hi

Im using your library in a project that im working on. I use it to comunicate with an arduino

I have a listenToArdu and a talkToArdu fuctions in of

The issue that im having its that i can not call the two fuctions, if i send i can receive and viceversa

Im using a SeriaDevice objec
Thanks!

can't build example_buffered_serial_device against OF 0.9

on Mac OS X 10.10.5 with of 0.9, after updating the example's Xcode project I got this error :

/Users/antoine/dev/of_v0.9.0_osx_release/addons/ofxSerial/libs/ofxSerial/src/SerialDeviceUtils.cpp:51:22: error: no type named 'RegularExpressionException' in namespace 'Poco'
        catch (Poco::RegularExpressionException& exception)

device.send() doesn't work in ofApp::setup() - PacketSerial

Hi,
I'm using this addon for an installation where I'm controlling multiple steppers and servos and it works great if the code where I send the message via serial is inside an event listener function (like mousePressed() or keyPressed() ), but not if I use it inside setup() or update().

To be more precise, this is the code that I'm using to send the osc message via serial (modelled on the OSC-SLIP packet example):

ofxOscMessage osc_message;
osc_message.setAddress("/home");
osc_message.addIntArg(1);

send_osc_bundle(osc_message, cnc_device, 1024);
  1. If I only put these 4 lines inside a ofApp::keyPressed(), it works ok. ✅

  2. If I instead put them inside ofApp::setup() , after setting up the serial device, it does not work. ❌

  3. Finally, if I put them inside ofApp::setup() and also inside ofApp::keyPressed(), even the keyPressed() event doesn't work. ❌

For reference, this is my send_osc_bundle().

//--------------------------------------------------------------
void ofApp::send_osc_bundle(ofxOscMessage &m, ofxIO::SLIPPacketSerialDevice &device, int buffer_size){
    
    // this code comes from ofxOscSender::sendMessage in ofxOscSender.cpp
    // static const int OUTPUT_BUFFER_SIZE = buffer_size;
    char buffer[buffer_size];

    // create the packet stream
    osc::OutboundPacketStream p(buffer, buffer_size);
    
    p << osc::BeginBundleImmediate; // start the bundle
    append_message(m, p);           // add the osc message to the bundle
    p << osc::EndBundle;            // end the bundle
 
    // send to device
    device.send(ofxIO::ByteBuffer(p.Data(), p.Size()));
}

The append_message() is the exact same code of the examples.

Any hint would be great! I've been struggling with this for quite a while.

Thanks!

can't handle errors (app crash) when using packetSerial and usb disconnects (Windows/0.9.8)

hey @bakercp ,
I used the addon and is working really fine! (Windows 10, OF 0.9.8 with ofxSerial master branch).

But when using the packetSerial mode / example, the OF app crashes when disconnected the USB cable. (example_packet_serial and example_SLIPPacketSerial)

I used the other examples templates without packetSerial, and when the cable is disconected the OF app do not crashes. Btw I used to reconnect the serial when the cable is plugged again, and the OF app contiues working fine.

I would like to handle this errors and avoid this crash, because usually the app window can't be closed, and I have to reboot the machine to get it working again.
(I would like to use the packetSerial arduino library, so I don't have to handle the start/finish bytes by hand...)

Complie Error

Dear bakercp

First, Im sorry, Im very new here.

pi@raspberrypi:~/openFrameworks/apps/myApps/etal $ make
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio gtk+-3.0
with PKG_CONFIG_LIBDIR=
Compiling OF library for Release
make[1]: Entering directory '/home/pi/openFrameworks/libs/openFrameworksCompiled/project'
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio gtk+-3.0
with PKG_CONFIG_LIBDIR=
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio gtk+-3.0
with PKG_CONFIG_LIBDIR=
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio gtk+-3.0
with PKG_CONFIG_LIBDIR=
Done!
make[1]: Leaving directory '/home/pi/openFrameworks/libs/openFrameworksCompiled/project'


Compiling etal for Release
make[1]: Entering directory '/home/pi/openFrameworks/apps/myApps/etal'
HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio gtk+-3.0
with PKG_CONFIG_LIBDIR=
Compiling /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp
g++ -c -O3 -DNDEBUG -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -march=armv6 -mfpu=vfp -mfloat-abi=hard -fPIC -ftree-vectorize -Wno-psabi -pipe -DOF_USING_GTK -DTARGET_RASPBERRY_PI -DSTANDALONE -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -DHAVE_LIBOPENMAX=2 -DOMX -DOMX_SKIP64BIT -DUSE_EXTERNAL_OMX -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM  -I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -pthread -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/AL -I/usr/include/arm-linux-gnueabihf -I/usr/include/rtaudio -I/usr/include/alsa -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/libdrm -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/uuid -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/home/pi/openFrameworks/libs/glm/include -I/home/pi/openFrameworks/libs/glm/include/glm -I/home/pi/openFrameworks/libs/glm/include/glm/simd -I/home/pi/openFrameworks/libs/glm/include/glm/gtx -I/home/pi/openFrameworks/libs/glm/include/glm/gtc -I/home/pi/openFrameworks/libs/glm/include/glm/detail -I/home/pi/openFrameworks/libs/json/include -I/home/pi/openFrameworks/libs/kiss/include -I/home/pi/openFrameworks/libs/tess2/include -I/home/pi/openFrameworks/libs/utf8/include -I/home/pi/openFrameworks/libs/utf8/include/utf8 -I/home/pi/openFrameworks/libs/openFrameworks -I/home/pi/openFrameworks/libs/openFrameworks/gl -I/home/pi/openFrameworks/libs/openFrameworks/3d -I/home/pi/openFrameworks/libs/openFrameworks/video -I/home/pi/openFrameworks/libs/openFrameworks/graphics -I/home/pi/openFrameworks/libs/openFrameworks/app -I/home/pi/openFrameworks/libs/openFrameworks/types -I/home/pi/openFrameworks/libs/openFrameworks/utils -I/home/pi/openFrameworks/libs/openFrameworks/events -I/home/pi/openFrameworks/libs/openFrameworks/sound -I/home/pi/openFrameworks/libs/openFrameworks/communication -I/home/pi/openFrameworks/libs/openFrameworks/math -I/home/pi/openFrameworks/apps/myApps/etal/src -I/home/pi/openFrameworks/addons/ofxPoco/src -Isrc -I/home/pi/openFrameworks/addons/ofxIO/src -I/home/pi/openFrameworks/addons/ofxIO/libs -I/home/pi/openFrameworks/addons/ofxIO/libs/ofxIO -I/home/pi/openFrameworks/addons/ofxIO/libs/ofxIO/include -I/home/pi/openFrameworks/addons/ofxIO/libs/ofxIO/include/ofx -I/home/pi/openFrameworks/addons/ofxIO/libs/ofxIO/include/ofx/IO -I/home/pi/openFrameworks/addons/ofxIO/libs/ofxIO/src -I/home/pi/openFrameworks/addons/ofxIO/libs/snappy -I/home/pi/openFrameworks/addons/ofxIO/libs/snappy/src -I/home/pi/openFrameworks/addons/ofxIO/libs/alphanum -I/home/pi/openFrameworks/addons/ofxIO/libs/alphanum/include -I/home/pi/openFrameworks/addons/ofxIO/libs/brotli -I/home/pi/openFrameworks/addons/ofxIO/libs/brotli/src -I/home/pi/openFrameworks/addons/ofxIO/libs/brotli/src/common -I/home/pi/openFrameworks/addons/ofxIO/libs/brotli/src/tools -I/home/pi/openFrameworks/addons/ofxIO/libs/brotli/src/enc -I/home/pi/openFrameworks/addons/ofxIO/libs/brotli/src/dec -I/home/pi/openFrameworks/addons/ofxIO/libs/lz4 -I/home/pi/openFrameworks/addons/ofxIO/libs/lz4/src -I/home/pi/openFrameworks/addons/ofxSerial/src -I/home/pi/openFrameworks/addons/ofxSerial/libs -I/home/pi/openFrameworks/addons/ofxSerial/libs/ofxSerial -I/home/pi/openFrameworks/addons/ofxSerial/libs/ofxSerial/include -I/home/pi/openFrameworks/addons/ofxSerial/libs/ofxSerial/include/ofx -I/home/pi/openFrameworks/addons/ofxSerial/libs/ofxSerial/include/ofx/IO -I/home/pi/openFrameworks/addons/ofxSerial/libs/ofxSerial/src -I/home/pi/openFrameworks/addons/ofxSerial/libs/serial -I/home/pi/openFrameworks/addons/ofxSerial/libs/serial/include -I/home/pi/openFrameworks/addons/ofxSerial/libs/serial/include/serial -I/home/pi/openFrameworks/addons/ofxSerial/libs/serial/include/serial/impl -I/home/pi/openFrameworks/addons/ofxSerial/libs/serial/src -I/home/pi/openFrameworks/addons/ofxSerial/libs/serial/src/impl -I/home/pi/openFrameworks/addons/ofxSerial/libs/serial/src/impl/list_ports -MMD -MP -MF obj/linuxarmv6l/Release/src/main.d -MT obj/linuxarmv6l/Release/src/main.o -o obj/linuxarmv6l/Release/src/main.o -c /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp
In file included from /home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.hpp:579,
                 from /home/pi/openFrameworks/libs/glm/include/glm/ext.hpp:48,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVectorMath.h:21,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:37,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl: In function ‘glm::vec2 glm::unpackUnorm2x8(glm::uint16)’:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl:377:37: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘glm::u8vec2’ {aka ‘struct glm::tvec2<unsigned char, (glm::precision)0>’} from an array of ‘glm::uint16’ {aka ‘short unsigned int’} [-Wclass-memaccess]
   memcpy(&Unpack, &p, sizeof(Unpack));
                                     ^
In file included from /home/pi/openFrameworks/libs/glm/include/glm/vec2.hpp:6,
                 from /home/pi/openFrameworks/libs/openFrameworks/events/ofEvents.h:8,
                 from /home/pi/openFrameworks/libs/openFrameworks/utils/ofURLFileLoader.h:3,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:11,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/detail/type_vec2.hpp:19:9: note: ‘glm::u8vec2’ {aka ‘struct glm::tvec2<unsigned char, (glm::precision)0>’} declared here
  struct tvec2
         ^~~~~
In file included from /home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.hpp:579,
                 from /home/pi/openFrameworks/libs/glm/include/glm/ext.hpp:48,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVectorMath.h:21,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:37,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl: In function ‘glm::vec2 glm::unpackSnorm2x8(glm::uint16)’:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl:409:37: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘glm::i8vec2’ {aka ‘struct glm::tvec2<signed char, (glm::precision)0>’} from an array of ‘glm::uint16’ {aka ‘short unsigned int’} [-Wclass-memaccess]
   memcpy(&Unpack, &p, sizeof(Unpack));
                                     ^
In file included from /home/pi/openFrameworks/libs/glm/include/glm/vec2.hpp:6,
                 from /home/pi/openFrameworks/libs/openFrameworks/events/ofEvents.h:8,
                 from /home/pi/openFrameworks/libs/openFrameworks/utils/ofURLFileLoader.h:3,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:11,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/detail/type_vec2.hpp:19:9: note: ‘glm::i8vec2’ {aka ‘struct glm::tvec2<signed char, (glm::precision)0>’} declared here
  struct tvec2
         ^~~~~
In file included from /home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.hpp:579,
                 from /home/pi/openFrameworks/libs/glm/include/glm/ext.hpp:48,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVectorMath.h:21,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:37,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl: In function ‘glm::vec4 glm::unpackUnorm4x16(glm::uint64)’:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl:437:37: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘glm::u16vec4’ {aka ‘struct glm::tvec4<short unsigned int, (glm::precision)0>’} from an array of ‘glm::uint64’ {aka ‘long long unsigned int’} [-Wclass-memaccess]
   memcpy(&Unpack, &p, sizeof(Unpack));
                                     ^
In file included from /home/pi/openFrameworks/libs/glm/include/glm/vec4.hpp:6,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVec4f.h:8,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVec3f.h:5,
                 from /home/pi/openFrameworks/libs/openFrameworks/types/ofPoint.h:3,
                 from /home/pi/openFrameworks/libs/openFrameworks/types/ofParameter.h:5,
                 from /home/pi/openFrameworks/libs/openFrameworks/utils/ofJson.h:4,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:21,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/detail/type_vec4.hpp:19:9: note: ‘glm::u16vec4’ {aka ‘struct glm::tvec4<short unsigned int, (glm::precision)0>’} declared here
  struct tvec4
         ^~~~~
In file included from /home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.hpp:579,
                 from /home/pi/openFrameworks/libs/glm/include/glm/ext.hpp:48,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVectorMath.h:21,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:37,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl: In function ‘glm::vec4 glm::unpackSnorm4x16(glm::uint64)’:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl:469:37: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘glm::i16vec4’ {aka ‘struct glm::tvec4<short int, (glm::precision)0>’} from an array of ‘glm::uint64’ {aka ‘long long unsigned int’} [-Wclass-memaccess]
   memcpy(&Unpack, &p, sizeof(Unpack));
                                     ^
In file included from /home/pi/openFrameworks/libs/glm/include/glm/vec4.hpp:6,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVec4f.h:8,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVec3f.h:5,
                 from /home/pi/openFrameworks/libs/openFrameworks/types/ofPoint.h:3,
                 from /home/pi/openFrameworks/libs/openFrameworks/types/ofParameter.h:5,
                 from /home/pi/openFrameworks/libs/openFrameworks/utils/ofJson.h:4,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:21,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/detail/type_vec4.hpp:19:9: note: ‘glm::i16vec4’ {aka ‘struct glm::tvec4<short int, (glm::precision)0>’} declared here
  struct tvec4
         ^~~~~
In file included from /home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.hpp:579,
                 from /home/pi/openFrameworks/libs/glm/include/glm/ext.hpp:48,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVectorMath.h:21,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:37,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl: In function ‘glm::vec4 glm::unpackHalf4x16(glm::uint64)’:
/home/pi/openFrameworks/libs/glm/include/glm/./gtc/packing.inl:505:37: warning: ‘void* memcpy(void*, const void*, size_t)’ copying an object of non-trivial type ‘glm::i16vec4’ {aka ‘struct glm::tvec4<short int, (glm::precision)0>’} from an array of ‘glm::uint64’ {aka ‘long long unsigned int’} [-Wclass-memaccess]
   memcpy(&Unpack, &v, sizeof(Unpack));
                                     ^
In file included from /home/pi/openFrameworks/libs/glm/include/glm/vec4.hpp:6,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVec4f.h:8,
                 from /home/pi/openFrameworks/libs/openFrameworks/math/ofVec3f.h:5,
                 from /home/pi/openFrameworks/libs/openFrameworks/types/ofPoint.h:3,
                 from /home/pi/openFrameworks/libs/openFrameworks/types/ofParameter.h:5,
                 from /home/pi/openFrameworks/libs/openFrameworks/utils/ofJson.h:4,
                 from /home/pi/openFrameworks/libs/openFrameworks/ofMain.h:21,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:1:
/home/pi/openFrameworks/libs/glm/include/glm/detail/type_vec4.hpp:19:9: note: ‘glm::i16vec4’ {aka ‘struct glm::tvec4<short int, (glm::precision)0>’} declared here
  struct tvec4
         ^~~~~
In file included from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:2:
/home/pi/openFrameworks/apps/myApps/etal/src/ofApp.h: At global scope:
/home/pi/openFrameworks/apps/myApps/etal/src/ofApp.h:26:28: error: cannot declare field ‘ofApp::device’ to be of abstract type ‘ofx::IO::PacketSerialDevice_<ofx::IO::COBSEncoding>’
  ofxIO::PacketSerialDevice device;
                            ^~~~~~
In file included from /home/pi/openFrameworks/addons/ofxSerial/src/ofxSerial.h:16,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/ofApp.h:4,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:2:
/home/pi/openFrameworks/addons/ofxSerial/libs/ofxSerial/include/ofx/IO/PacketSerialDevice.h:22:7: note:   because the following virtual functions are pure within ‘ofx::IO::PacketSerialDevice_<ofx::IO::COBSEncoding>’:
 class PacketSerialDevice_: protected BufferedSerialDevice
       ^~~~~~~~~~~~~~~~~~~
In file included from /home/pi/openFrameworks/addons/ofxIO/src/ofxIO.h:18,
                 from /home/pi/openFrameworks/addons/ofxSerial/src/ofxSerial.h:12,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/ofApp.h:4,
                 from /home/pi/openFrameworks/apps/myApps/etal/src/main.cpp:2:
/home/pi/openFrameworks/addons/ofxIO/libs/ofxIO/include/ofx/IO/AbstractTypes.h:107:25: note:    ‘virtual std::size_t ofx::IO::AbstractByteSink::writeBytes(std::initializer_list<unsigned char>)’
     virtual std::size_t writeBytes(std::initializer_list<uint8_t> bytes) = 0;
                         ^~~~~~~~~~
make[1]: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:223: obj/linuxarmv6l/Release/src/main.o] Error 1
make[1]: Leaving directory '/home/pi/openFrameworks/apps/myApps/etal'
make: *** [/home/pi/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2

I`ve got these error on Rpi3 B+ with Rasbian Lite.
I searched a lot, but I cannot solve this. Please, give me a little hint...

Thanks.

Serial communication not working until opening arduino serial monitor

Dear bakercp,

thank you very much for your awesome work!
I have a problem when using ofxSerial with serial communication to arduino on windows. When plugging arduino it does not work: Arduino is found ("successfully setup COM5…"), but no communication happens. "onSerialBuffer seems to never fire. Trying to send something gives me "IO exeption. Error while writing to the serial port. … |ibs\serial\src\impl\win.cc, line 343."
After opening and closing arduino serial monitor it works without problems.

I can produce the problem on a Computers running Windows 10 with both OF 0.9.8. vs and OF 0.9.4 vs as well as on another Computer running Windows 7 OF 0.9.8 vs. ofxIO is stable branch and ofxSerial is master branch in all three cases.
Ubuntu OF 0.9.4. works without any problem.

It's not completely sure this problem is specific to ofxSerial, still I can reproduce it also in example_buffered_serial_device, while ofSerial example works well.
I'd be happy if you had any advise. I'm ready to do further testing of course.

thanks and have a good day!
oe

cant' make work the example_SLIP-OSC

hey @bakercp , thanks for the addon and the new improvements!

I had errors of out of memory on the Arduino code (using the Arduino IDE ). Then I uploaded the code with the Eclipse Arduino IDE and then upload worked. But the LED do not switch his state.

When the OF app is not linked to Arduino, it hangs blinking like if it was looped on the setup function. When they are linked, nothing happens on Arduino when clicking the OF app. Seems that LEDcontrol function is not called to run...

I am using an Arduino Mega.

packet serial

I want to take a look at the packet serial example, but im not able to make it work.

Im using an arduino mega, uploading just the example, and im running OS X oF0.9, everything compiles and runs ok.

The arduino example also upload to the board without issues, but i see no data coming back from the arduino, onSerialBuffer function never get called.

What can be wrong?

Changing Custom Baudrate

Dear. bakercp

This time it is related to baudrate. I needed 250k speed, so I looked around and fixed it in /home/pi/openFrameworks/addons/ofxSerial/libs/serial/src/impl/unix.cc.

#ifdef B256000

#ifdef B250000 //orgin was B256000 case 250000: baud = B250000; break; #endif
But that was not working. and Ive got SerialDevice::setup: IO Exception (95): Operation not supported, file /home/pi/openFrameworks/addons/ofxSerial/libs/serial/src/impl/unix.cc, line 332.`

I am wondering if baudrate is not supported in rpi3 b + or if there is a way to do it.
oFserial can make 250k. Is there any method?

Thanks, and sorry for lower question..

sending data through OSC to 80 servo motors is too big?

Hey@bakercp,
I am making a project which needs to control 80 servo motors (daisy chained) from OF to Arduino, I was trying your 'example_packet_serial_slip', the example didn't work with Arduino Mega but worked with Arduino Uno.
I therefore changed to 'example_SLIP-OSC' as I need to use Mega to control something else as well. It worked with 20 servo motors, however, it will have some sort of unstable data for the servos if I increase the number of the micro servo motors (more than 25). I guess it might be the data I was sending is too big to send via OSC? Any suggestions would be really appreciated.

WIN support

Finish writing windows support. Very close. Just need to finish it.

CodeBlocks Win32

I'm having a bit of an issue getting a simple project to compile under codeblock (win32, gcc).

I get the following error:

F:\of_v0.8.0_win_cb_release\addons\ofxSerial\libs\ofxSerial\src\SerialDeviceUtils.cpp|65|error: no 'void ofx::IO::SerialDeviceUtils::enumerateWin32Ports()' member function declared in class 'ofx::IO::SerialDeviceUtils'|
||=== Build finished: 1 errors, 0 warnings ===|

compiled but crashed

hello bakercp !
at first, thank you for this great addon.

I can compile example but when I try running, it crashed.

HOST_OS=Linux
checking pkg-config libraries:   cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 libmpg123 
with PKG_CONFIG_LIBDIR=
/bin/sh: line 1:  6990 Segmentation fault      (core dumped) ./example_buffered_serial_device
make: *** [/home/icq4ever/oF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:197: RunRelease] Error 139
The terminal process terminated with exit code: 2

it's arch linux x64, openFrameworks 0.10.1
ofxSerial , ofxIO addons are stable branch.

is there anything I missed..?

onSerialBuffer is blocking

I am noticing that when ever I receive a serial signal from my Arduino in

void onSerialBuffer(const ofxIO::SerialBufferEventArgs& args){
}

My app freezes for a split second.

Is there a way to make this event non-blocking?

Thanks for any advice.

Here the whole function:

   void onSerialBuffer(const ofxIO::SerialBufferEventArgs& args){
        // Buffers will show up here when the marker character is found.
        ofLog()<<"serial args.buffer() "<<args.buffer();
        vector<string> splitStr = ofSplitString(args.buffer().toString(), ":");
        
        if(splitStr[0] == "s"){
            //states
            ofLog()<<"serial state:"<<splitStr[1] <<" splitStr[2] "<<splitStr[2];
            if(ofIsStringInString(splitStr[1], "upper")){
                
                upperSwitchState_str = splitStr[2];
                if(splitStr[2] == "ON"){
                    upperSwitchState = true; 
                } else {
                    upperSwitchState = false;
                }
            } else if(ofIsStringInString(splitStr[1], "lower")){
                lowerSwitchState_str = splitStr[2];
                
                if(splitStr[2] == "ON"){
                    lowSwitchState = true; 
                } else {
                    lowSwitchState = false;
                }
                
            }
            
        } else if(splitStr[0] == "i"){
            //info
            ofLog()<<"serial info:"<<splitStr[1];
            
        } else if(splitStr[0] == "a"){
            //alive
            aliveTimer = ofGetElapsedTimef();
            aliveCounter = ofToInt(splitStr[1]);
        } else {
            
        }
        
        
    }

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.