Cant use Micro-Coap library for arduino - sockets

I am trying to get the micro-coap librarby (https://github.com/1248/microcoap)
to work on my arduino. When I try to compile it in the Arduino IDE, it reports that <sys/socket.h> dependency in main-posix.c can not be found.
Searches for the problem were not helpful, except for some general C++ answer that was hinting that there is no sys/socket.h on Windows. But this should not have anything to do with Arduino right?
I looked at the ethernet library for arduino and there is a socket.h but it is not in a sys directory.
Hope you can help

It seems that the main-posix.c source file is meant to be compile for a UNIX/LINUX based operating system. If you want to use Windows to compile main-posix.c, you can use projects like Cygwin. Arduino does not have <sys/socket.h> dependency needed to compile main-posix.c. Instead open microcoap.ino in the Arduino IDE and compile and flash it to the hardware.

Someone suggested simply taking the file out of the arduino path / deleting it and that worked. As Stefan posted in his answer, it is used to build the library on unix/linux and has no relevance for arduino.

Related

Python in EV3 - What modules are installed?

I have specific question. I have lego EV3 and i installed Micropython. But i want import turtle, tkinter and other modules and they aren't in micropython. But time module working.Do someone know what modules are in ev3 micropython? Thanks for answer.
welcome to Stackoverflow. MicroPython is very specific to the board it has been ported to run on. There are both standard libraries and hardware specific libraries in your MicroPython port and then open-source libraries you can install. I bet MOST of the Python and MicroPython specific libraries will be in your image. More on Libraries here: http://docs.micropython.org/en/latest/library/index.html
I did not see any online documentation for Lego's MicroPython version online. If you can find it, it may have this information. If so, please post back the link in the comments.
In the absence of good documentation you can discover what is available using help().
From the link above...
On some ports you are able to discover the available, built-in libraries that can be imported by entering the following at the REPL:
help('modules')
Your other question is will every Python library work on MicroPython? No. Most will not. You can search for libraries which will work on https://libraries.io. Just be sure to use the filters to narrow the results to MicroPython libraries.
If you are in fact running micropython, you're probably not going to find any of those modules. It has "micro" in the name of a reason; while it supports a great deal of Python 3 syntax, it is not fully compatible with C python and most modules not written explicitly for micropython won't work.
You can get a list of built-in modules by running help("modules"), and you can see any modules installed on the filesystem using os.listdir().

Problem installing mjs library (embedded javascript) using platformio cli

I get a build error when trying to use a function in mjs after importing it into platformio:
platformio lib --storage-dir lib install https://github.com/cesanta/mjs.git
I can try #include <../lib/mjs/mjs.h>, but it will only include the header file and not the .c files. Nothing is being linked.
How can I get mjs (or any external library with a .c in it) setup as a platformio library?
Details:
I can try #include <mjs.h> or #include <mjs/mjs.h> in main.c, neither work.
I expect libraries to be copied to .pioenvs while they are being compiled. But that doesn't look to be the case.
I have tried several things from my favorite search engine. But no luck. Platformio documentation doesn't seem to be much help either. If you think this requires submitting a github issue, let me know in a comment.
ESP32 espressif DFU library Version 1.5
Currently on Windows 10 (will also be using WSL Debian, Gentoo Linux, and Mac in future)
platformio.ini
[env:esp32dev]
platform = espressif32
framework = espidf
board = esp32dev
build_flags = -DCONFIG_WIFI_SSID=\"ESP_AP\" -DCONFIG_WIFI_PASSWORD=\"MYPASS\"
monitor_speed = 115200
p.s. I understand there is a gpl restriction after I finish the
prototyping phase (while prototyping, there is no restrictions). So I
do plan on buying a commercial license. I don't think this library
would be a good fit in the platformio store. I want a local-only library.
But many libraries out there could follow the found steps, expanding
platformio usability...
mjs has a previous project named v7. I am still interested in importing external libraries. But this satisfies my need for now.
platform.ini
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
build_flags = -I lib/mjs
-L lib/mjs
-I lib/TFT_eSPI-master
-L lib/TFT_eSPI-master
-Os
-DPIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DUSER_SETUP_LOADED=1
-DILI9163_DRIVER=1
-DTFT_WIDTH=128
-DTFT_HEIGHT=160
-DTFT_MISO=19
-DTFT_MOSI=23
-DTFT_SCLK=18
-DTFT_CS=5
-DTFT_DC=19
-DTFT_RST=-1
-DLOAD_GLCD=1
-DSPI_FREQUENCY=27000000
Got mjs to work. https://github.com/tamusjroyce/platformio-esp32-mjs
Note: MJS is GPL V2 or commercial. License is reasonable. I am in no
way affiliated with Ciesta, MongooseOS, or mjs. Hence, v7 (which I believe is licensed differently?).

eclipse - Linking together OpenCV libraries and Arduino Sketches

I am trying to incorporate OpenCV libraries in Arduino sketches using Eclipse. As a start, I separate the 2 prjects, OpenCV code and a simple Arduino sketch. They both compile and run beautifully in separate projects after linking everything OpenCV libraries and Arduino libraries, respectively. So then, I try adding OpenCV code into the Arduino sketch project to try and get them to run together. Even after the same linking as I did with the OpenCV project, there are compiling errors such as type '___' could not be resolved. The header inclusions like
#include <iostream>
#include <cv.h>
#include <highgui.h>
seem to not have errors to them. In the console I would have compilation errors until building such as /usr/include/c++/4.8/iostream:38:28: fatal error: bits/c++config.h: No such file or directory. I didn't have this error with the individual OpenCV project. So maybe the AVR C++ compiler is missing something the native c++ compiler has.
I don't get what I am doing wrong or know what I am forgetting.
Any help would be appreciated. Thanks!
It looks like you are trying to program OpenCV into the Arduino. Assuming you wnat to run this code in Arduino Uno, you are never be able to run OpenCV even though you successful compile the project. Arduino Uno has only around 2kb of RAM (think how big the image file you want to process is) and does not have enough flash memory for OpenCV code.
You have to look for another way like running separated OpenCV project on your computer and communicate with Arduino Uno through serial port or something.

Library libusb 1.0.9 on Raspberry Pi

I am having a problem with compilation of my Java file.
I want to use the libusb-1.0.9 library, but the problem is that it cannot find the symbols, like LibUsbException, LibUsb.bulkTransfer, etc. The code is written in the nano text editor, and I have no idea how to implement this library to my code.

MATLAB Compiler

I use MATLAB 2012a. I need to compile a mex file in my program. Everything works fine with Microsoft SDK 7.1 but I need a minor compiler in order to work my program in other computers. Suggested compilers on MathWorks website are compilers that need to be installed as packages. Is there any compilers that work stand-alone and don't need to be installed?
You can use MinGW, but it is not straightforward. See this Q&A. The accepted answer suggest to compile and link MEX files outside of MATLAB, which is fine, but it's simple to just create mexopts.bat to do this.
A good mexopts.bat for MING is hosted here. Pick a MINGW distribution from win-builds and set the paths in mexopts. Then you can use mex -setup with this file.
gnumex is a disaster, IMO.