I'm using my arduino yun board to try a protocol I've made to control a robot I'm making using arduino.
The same job, using a raspberry pi for the previous project, worked pretty well and I had no issues with anything at all.
Basically, my environment WAS:
Raspberry PI
Arduino mega (board)
NodeJS
NodeJS serial module
Aaaand I had literally no problems, but since I was very confident with the arduino yun board, I decided to try doing basically the same thing but, instead of using my raspberry pi, I wanted to use only my arduino yun board.
After correctly configuring the arduino yun board, compiling, and installing nodejs following this guide, I correctly can run node:
Cool.
Now, npm, unluckily doesn't work (as expected from the above tutorial):
Since npm is not working, I proceded this way:
Under /www/, I've made a directory called "nodejsTEST":
cd www
mkdir nodejsTEST
accessed it, and made a pretty basic server.js file:
The above code works perfectly, and by accessing at arduino.local/nodejsTEST it actually outputs "Ohay :)".
Now, next step:
I downloaded the same library I was using on the raspberry pi:
https://github.com/voodootikigod/node-serialport
and, since I can't use npm, I've copied it to the nodejsTEST folder but, when I'm requiring it from nodejs (I've looked around here in stackoverflow about how to include it correctly) keeps telling that some modules are missing, suchs as this one:
I've tried downloading the module itself but it doesn't work at all, so what I was wondering is where all the modules were stored, since there usually is a /usr/local/bin/node folder.
Surprisingly, there literally is no trace about node.
Even by printing its path and trying to access it, it's telling me the path does not exists:
Any idea of how to solve this issue? I'm really looking forward to be able to use the serial port library with nodejs, since I had a really positive experience on my previous project both from the point of view of the performance and from the point of view of its stability.
Thanks.
After looking around for (quite long) while, I came up with this link:
http://blog.arduino.cc/2014/05/06/time-to-expand-your-yun-disk-space-and-install-node-js/
Which actually allows you to use your external SD card as available space either for linino and for storing basicly anything and, moreover, it actually even allows you to install both Nodejs and the Nodejs-serialport module.
Related
I'm developing a VSCode Extension where you can develop CircuitPython code. I want it to be able to upload your code to your pico, or whatever microcontroller you're using.
For this I need to detect all usb drives that are connected, I've tried libraries like node-usb, usb-detection, etc. But they always give some kind of error, for usb-detection for example you need to rebuild the library with this command:
./node_modules/.bin/electron-rebuild
But then I get greeted with this:
text here: https://pastebin.com/E7bjtWgP
I have absolutely no idea what anything of this means, I've installed vs build tools 2022, 2017 and even added it to my community installation.
After that I tried the usb library. Which again, greets me very kindly with:
I've also tried some other libraries but they all give a similar result. Some do this:
And I've also seen some very questionable things like this:
I've been googling, and debugging now for roughly 4 hours and atm I'm tired so I'll probably try again in a couple of hours.
EDIT:
I've made an entirely new project, moved over all the code and it now works. I have absolutely no idea what the problem was but at least its working now.
I am working on a project that edits photos of mine and then uploads those photos to a google site. I'm using Selenium to upload the photos to the portfolio site, but I need a way to select the image I want to upload from the file manager.
The idea is that this project will run on my Raspberry Pi 3b without any need for human intervention. Is it even possible to emulate human interactions with the OS?
I have done some research and have come across the program AutoKey, but I am not entirely sure if this will work for what I need on Raspbian. Any help would be greatly appreciated.
Update:
I attempted to install autokey on to my raspberry pi, and even though the install seemed successful, I am unable to open or use the application. It seems I may be missing some dependencies or that autokey just isn't compatible on Raspbian. All I really need is a way for me to navigate to the path of the photo I want to upload and to select it.
Second Update:
While searching through the selenium documentation I found this https://selenium-python.readthedocs.io/faq.html#how-to-upload-files-into-file-inputs which seems like it could be a solution. I have not yet had time to try this out yet on both my Macbook and Raspberry Pi.
Final Update
I was able to upload the file using selenium, but part of the process is jerry-rigged to work. I am curious to know if there is another, more professional way to do this so I will leave the question up in the meantime.
I'm working for a public library in my town, and I have developed a web application to handle the borrowing process and other administration problem. A few years ago, the library bought and attached the books in the library with a RFID tag, and with it, also bought a RFID Reader to be used in the borrowing process, and a RFID Sensor Security Gate, to prevent the books from being taken out without proper administration process. For the RFID Reader to be used, the vendor gave me a JAVA applet to connect the RFID Reader to my web application, as it's not possible to access a device from the web with just Javascript or JQuery.
Currently, the library is asking me to develop a kiosk application for the library's self service center. I currently developing the kiosk application with Node JS, and I managed to create the user and password authentication with native Javascript and AJAX function.
However, problem occured when I tried to use the RFID Reader to detect the books. I tried using some modules called node-hid, but everytime I run the application, it gave me an error message.
I used:
Windows 10
Node v10.16.3
npm v6.9.2
Electron v5.0.6
Some poeple in the forums recommended to rebuild and reinstall the module and the node, but it's not working for me. Others told me to downgraded the Node or the npm using nvm, but from what i read, nvm only worked for Linux. Honestly, I'm still new in Node JS, and I'm a little bit confused: regarding the error message above, which one is actually the problem? The Node version, or the npm version?
Struggling, I tried to forget about using modules about RFID, and start from the scratch by detecting devices connected on USB first, so I use serialport module, but the same error persist.
I expected to be able to read the books' ID from the RFID tag, and rewrite some blocks in it to prevent the alarms from the RFID Sensor Security Gate goes off.
Any supports regarding the error above, or a recommendations to use another module will be appreciated. I'm at the end of my rope here.
I know this is a bit late but I'm putting it here just in case someone passed by it.
You are getting this error because you are using a native module which is ok for node, but because electron is a modified node, so in order for thhat to work: you need to rebuild for electron instead:
Add the electron-rebuild package
npm i -D electron-rebuild
Remove the node-modules folder, as well as the packages-lock.json file.
Run npm install to install all modules.
Run ./node_modules/.bin/electron-rebuild or .\node_modules\.bin\electron-rebuild.cmd for Windows to rebuild everything.
I'm currently working at a project in which I want to control a robot vehicle using a web application. I have chosen to build the application in node js and to host it on a Raspberry Pi 3 B. I installed npm and node js with its modules and everything works fine. I can see the web application form whatever device i want.
I was trying to use the npm module pi-gpio to control raspberry pi pins connected to the motors but I have an error:
"gpio-admin: failed to change group ownership of
/sys/devices/virtual/gpio/gpio22/direction: No such file or
directory."
However, the application works perfectly fine. The only thing helpful that I found after few hours of research is the fact that the module might not work on the Raspberry PI 3 B.
Therefore the question is, did anyone do a similar project using the raspberry pi 3 B or anyone has any idea how can i solve this issue?
Thank you!
Regards,
Alex
After getting out of a mode of procastinating, I've finally gotten to the item on the projects todo-list that says "Run on virtual device to see why it crashes".
My project is a libgdx application that I plan on porting to various platforms, the two most important ones being desktop and android.
During development I've exclusively used the desktop launcher, as it's a lot easier to fire up when just checking minor things.
I did build an .apk at one point just to see if it'd run out of the box, but it didn't. Now that I've tried via the virtual device, this is what the log says:
com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: rifleman.png
The same goes for any other assets that my game uses. The files are all placed in projectname/android/assets, as I remember learning way back that this was the way to go.
The virtual device I tried with is the stock Nexus 5, but I tried running the .apk by uploading it to my actual phone with a crash right after start, and I assume the problem is the same and is therefore unrelated to the test-platform.
I am currently not using an assetmanager, as implementing this is scheduled for after getting the basic core mechanics up and running. In the mean time I'm loading them as such: new Pixmap(new FileHandle("rifleman.png"));
Using android-studio 2.2 on Linux Mint 17 Cinnamon.
Please comment if more info is needed.
Use Gdx.files.internal() instead of FileHandle().
From filehandle(string) method info
Creates a new absolute FileHandle for the file name. Use this for
tools on the desktop that don't need any of the backends.
Do not use this constructor in case you write something cross-platform.