arduino | Assorted small Arduino hacks
kandi X-RAY | arduino Summary
kandi X-RAY | arduino Summary
This is a collection of small Arduino hacks. The Makefile at the top level of this directory is one that should work for any Arduino sketch. Just copy or symlink it into your sketch directory and make sure the sketch has the same name as the directory (e.g. blink/blink.ino).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of arduino
arduino Key Features
arduino Examples and Code Snippets
Community Discussions
Trending Discussions on arduino
QUESTION
Project largely working. Have a 125Khz RFID module on an Arduino Uno, with SD card module and and RTC, all working nicely and passing data via PLX-DAQ to Excel and storing data to SD card.
I need a way of working out when the Uno is connected via PLX-DAQ to USB/serial, or when the Uno is just on battery.
So I thought to set a particular cell on Excel with the PLX-DAQ form macro in VBA to 1 (when connected) or 0 (disconnected) then read that in the Arduino code to determine whether to pass data via serial to excel or pull stored data off SD card.
The cell J4 toggles 0 or 1 according to whether disconnected / connected.
I then use the GET function of PLX-DAQ to read a cell from the Arduino sketch.
To upload the sketch I have to disconnect the connection between the RFID Tx and Arduino Rx or I get an error, which is normal, and if I run the sketch with that wire disconnected GET works fine.
...ANSWER
Answered 2021-Jun-12 at 01:54I assume you leave the arduino TX wire connected to the PC-RX. Thats why your PLX-DAQ still has the input. And as you suspect nothing will be going back.
First I thought, since nothing will come back, so your code will be stuck on
QUESTION
I am using a 3.5: TFT LCD display with an Arduino Uno and the library from the manufacturer, the KeDei TFT library. The library came with a bitmap font table that is huge for the small amount of memory of an Arduino Uno so I've been looking for alternatives.
What I am running into is that there doesn't seem to be a standard representation and some of the bitmap font tables I've found work fine and others display as strange doodles and marks or they display upside down or they display with letters flipped. After writing a simple application to display some of the characters, I finally realized that different bitmaps use different character orientations.
My questionWhat are the rules or standards or expected representations for the bit data for bitmap fonts? Why do there seem to be several different text character orientations used with bitmap fonts?
Thoughts about the questionAre these due to different target devices such as a Windows display driver or a Linux display driver versus a bare metal Arduino TFT LCD display driver?
What is the criteria used to determine a particular bitmap font representation as a series of unsigned char values? Are different types of raster devices such as a TFT LCD display and its controller have a different sequence of bits when drawing on the display surface by setting pixel colors?
What other possible bitmap font representations requiring a transformation which my version of the library currently doesn't offer, are there?
Is there some method other than the approach I'm using to determine what transformation is needed? I currently plug the bitmap font table into a test program and print out a set of characters to see how it looks and then fine tune the transformation by testing with the Arduino and the TFT LCD screen.
My experience thus farThe KeDei TFT library came with an a bitmap font table that was defined as
...ANSWER
Answered 2021-Jun-12 at 16:19Raster or bitmap fonts are represented in a number of different ways and there are bitmap font file standards that have been developed for both Linux and Windows. However raw data representation of bitmap fonts in programming language source code seems to vary depending on:
- the memory architecture of the target computer,
- the architecture and communication pathways to the display controller,
- character glyph height and width in pixels and
- the amount of memory for bitmap storage and what measures are taken to make that as small as possible.
A brief overview of bitmap fonts
A generic bitmap is a block of data in which individual bits are used to indicate a state of either on or off. One use of a bitmap is to store image data. Character glyphs can be created and stored as a collection of images, one for each character in the character set, so using a bitmap to encode and store each character image is a natural fit.
Bitmap fonts are bitmaps used to indicate how to display or print characters by turning on or off pixels or printing or not printing dots on a page. See Wikipedia Bitmap fonts
A bitmap font is one that stores each glyph as an array of pixels (that is, a bitmap). It is less commonly known as a raster font or a pixel font. Bitmap fonts are simply collections of raster images of glyphs. For each variant of the font, there is a complete set of glyph images, with each set containing an image for each character. For example, if a font has three sizes, and any combination of bold and italic, then there must be 12 complete sets of images.
A brief history of using bitmap fonts
The earliest user interface terminals such as teletype terminals used dot matrix printer mechanisms to print on rolls of paper. With the development of Cathode Ray Tube terminals bitmap fonts were readily transferable to that technology as dots of luminescence turned on and off by a scanning electron gun.
Earliest bitmap fonts were of a fixed height and width with the bitmap acting as a kind of stamp or pattern to print characters on the output medium, paper or display tube, with a fixed line height and a fixed line width such as the 80 columns and 24 lines of the DEC VT-100 terminal.
With increasing processing power, a more sophisticated typographical approach became available with vector fonts used to improve displayed text quality and provide improved scaling while also reducing memory required to describe the character glyphs.
In addition, while a matrix of dots or pixels worked fairly well for languages such as English, written languages with complex glyph forms were poorly served by bitmap fonts.
Representation of bitmap fonts in source code
There are a number of bitmap font file formats which provide a way to represent a bitmap font in a device independent description. For an example see Wikipedia topic - Glyph Bitmap Distribution Format
The Glyph Bitmap Distribution Format (BDF) by Adobe is a file format for storing bitmap fonts. The content takes the form of a text file intended to be human- and computer-readable. BDF is typically used in Unix X Window environments. It has largely been replaced by the PCF font format which is somewhat more efficient, and by scalable fonts such as OpenType and TrueType fonts.
Other bitmap standards such as XBM, Wikipedia topic - X BitMap, or XPM, Wikipedia topic - X PixMap, are source code components that describe bitmaps however many of these are not meant for bitmap fonts specifically but rather other graphical images such as icons, cursors, etc.
As bitmap fonts are an older format many times bitmap fonts are wrapped within another font standard such as TrueType in order to be compatible with the standard font subsystems of modern operating systems such as Linux and Windows.
However embedded systems that are running on the bare metal or using an RTOS will normally need the raw bitmap character image data in the form similar to the XBM format. See Encyclopedia of Graphics File Formats which has this example:
Following is an example of a 16x16 bitmap stored using both its X10 and X11 variations. Note that each array contains exactly the same data, but is stored using different data word types:
QUESTION
I am trying to create a vector filled with class objects, and the class objects contain circular buffers as one of their members. I am running into this error:
...ANSWER
Answered 2021-Jun-10 at 20:38Looking at the code of the circular buffer:
QUESTION
Hi all I have an arduino and android app I need to write data from arduino to database without authentication but if user wants to see data from android app he needs to be authenticated how can I do it thanks.
...ANSWER
Answered 2021-Jun-10 at 07:42You have to first find whether the request is coming from arduino or andriod.
To make that happen, if it is GET method from client side you have to pass something like,
app=arduino or app=android in query params.
If it is a POST method you can send in request body(app: "arduino").
So in Django views, can declare some list like,
UN_AUTHENTICATED_METHODS = ['get_users']
get_users is a method
After that in your function,
QUESTION
This is a part of code in an arduino SPI communication instance.
...ANSWER
Answered 2021-Jun-09 at 19:14Before explaining, you have to understand a few things:
- Characters (i.e., a
char
type) can be treated as a number without any cast based upon its ASCII encoding - Strings in C always end with a NUL terminator. Importantly, this character has a numerical value of 0 (i.e., when you treat it as a number, it's equal to zero).
- Boolean values don't really exist in C independant of an integer representation. Zero is treated as "false" and anything else is treated as "true".
With this out of the way, let's look at what's happening in the loop.
First, we have a pointer p
that points at the first character of the string "Hello world!\n"
(this is coming from the statement const char* p = "Hello, world!\n"
).
At the top of the loop, we check our loop condition, which is c = *p
. Note that this assigns the value pointed at by p
into c
, and assignments in C evaluate to the value that's been assigned. What that means in this context is that our test is essentially just *p
.
Since booleans don't exist in C, *p
is false only when the character pointed at by p
has a value of zero. This can only happen when p
is pointing to a NUL terminator, which is always at the end of a string in C. Therefore, our loop will stop when we've hit the end of our string.
QUESTION
I am building a VB.NET Win Forms app that is reading the serial output of an Arduino and I want the VB.Net app to do something based on what it reads from the Arduino. The problem I am encountering is that even though I can read from the Arduino I can't seem to write it into an if statement.
The Arduino is a simple 3 button schematic. A red, yellow, and green button attached to digital pins 2,3, and 4. When one button is pressed the Arduino outputs the text "Red Button On", "Yellow Button On", or "Green Button On" depending on which button is pressed.
In the VB.Net app I have a label named lblHintRequest. I can load the arduino serial output onto this label. However, once I load the arduino serial output onto this label I can't seem to do anything with it. What I need is an if statement that will read which button is pressed and then do something depending on the button pressed. I have also tried adding a timer that ticks ever 500 ms that would read the label and this still did not work. The vb.net app just keeps skipping over the if statement.
The last thing I can think of trying is to use a textbox instead of a label and maybe that would help? But I really want this to be a label.
VB.NET Code ...ANSWER
Answered 2021-Jun-09 at 17:54Since you have the value returned by the Arduino in a variable, you can use it in your If
statement:
QUESTION
I've trying to work out why someone would write the following section of code in a Arduino loop. To me, it doesnt make sense, why have a return in a if statement? Does it just return to the start of the loop and not carry on with the rest of the loop. Here's the snippet of interest:
...ANSWER
Answered 2021-Jun-08 at 19:34After return ;
or just return;
(for void functions) the program exits from the loop and also from function. The function returns (for non-void functions). This statement applies when executing function already is not requeris.
QUESTION
First the problem.
The user can upload file from the web with ajax. If the file is relatively big, the uploading takes a while. If the user's connection is lost or something happens during the uploading process, the file is going to be damaged or empty.
How should I secure the upload process so the file remains the same if it fails for some reason?
I'm using the following libraries on the Arduino ESP32:
I have a basic file upload handler on my esp32 which looks like this:
...ANSWER
Answered 2021-May-20 at 06:45It seems to me that the problem solved.
I have managed to replace the String buffer with a char one in external memory. It seems stable but requires more testing. I'll post the solution but if anyone has a better approach feel free to comment here.
Thanks.
QUESTION
I am developing a web page (2075.mooo.com, (it is in Catalan)) where teachers control students' arrivals with an NFC card in an Arduino.
The thing is that I save students' data on .txt files, but Chrome saves those to its cache, and I have to constantly remove the cache files. Is there a way to not let Chrome do that or use another strategy instead of .txt files? Because I cannot say to all teachers and students to remove their chrome cache.
Thanks.
...ANSWER
Answered 2021-Jun-06 at 11:20Add this to a .htaccess file created in the directory you save the .txt files:
QUESTION
I'm running into an issue with trait bounds and can't understand what I'm doing wrong. I'm working with the arduino-uno crate from avr-hal and I have a function that reads the ADC, implemented as follows:
...ANSWER
Answered 2021-Jun-05 at 14:56The compiler error says:
the trait bound
&mut T: avr_hal_generic::embedded_hal::adc::Channel
is not satisfied
Notice that the error is asking for &mut T
to implement Channel
, &mut T: Channel<...>
, whereas your T
has the bound T: Channel<...>
— applying to T
itself rather than &mut T
. That's why the bound you've already written isn't helping.
Now, what's the right fix? If I look at the docs you linked, I can find the type of ::read
. (Note: I copied the text from the docs to construct this snippet; I didn't read the source code.)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install arduino
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page