#help-with-arduino
1 messages · Page 39 of 1
does anyone have a good resource to learn how to use pointers in arduino or how to read very large csv files from an SD card. I'm having a hard time gleaning much from the arduino documentation and forums
Are you talking about software serial on the arduino or on the Pc? @pulsar charm
Hmm, I use pointers all the time, but I don't know a good reference for doing so. Looking around a bit, I found this page https://www.dyclassroom.com/c/c-pointers-and-array-of-structures which mentions some useful details like arrays are actually pointers, strings are actually pointers, and uses the -> notation for pointers to structures.
For reading CSV files, you can either read a line at a time (break on newlines) and then split up the string with strtok() or whatever, or to save a little memory, you can read a token at a time. Note that if you have escaped commas or newlines, it's going to be trickier (also, there are at least four different ways of doing comma/newline escaping).
@north stream software serial is really nice indeed
@humble anchor on the arduino!
I would probably be using it much more moving forward since platformio allows me simultaneous upload to two unos at once
and the library basically helped me to steer clear of the hardware serial pins
@carmine sun I find that writing your code in object-oriented(OO) forces you to really know how pointers are used
other than that I've been relying on the documentation on http://www.cplusplus.com/doc/tutorial/pointers/
I think codeacademy has a new class and pointers course out but I think that just scratches the surface
but its a good introduction if you are just starting out
I tend to think of objects as having "handles" more than "pointers", as to me pointers are a low-level concept (a memory address), and objects abstract that away to classes, instances, and methods.
I think in OO pointers to object instances was my big hurdle to understanding the entire concept
@north stream If I placed an LED on the TX software serial pin, will I get that blinky feedback
Yeah, the LED doesn't care how the pin is being driven, it just lights up if there's a voltage difference.
awesome! I was starting to miss the heartbeart
cant believe it took me this long to use software serial
sorry, I just checked back in, thanks for the help
anyone having trouble getting trinket m0 on arduino ide?
is it still the case in SoftwareSerial that you cannot receive bytes while you send bytes?
To install Trinket M0, you need to install both the Arduino SAMD board package and the AdaFruit SAMD board package.
@north stream hi, I was able to get arduino but not adafruit
Follow this
@humble anchor Ifollowed the guid but same problem
Do you have multiple json links in the third party board section?
no just the one provided
Can you maybe give a screenshot of the boards manager with adafruit typed in?
Aaah, you have installed it
The boards should appear in the list with the other boards
but the only adafruit board is circuit playground
Could you sends a screenshot of the board list?
And when you scroll down you still dont see it?
@humble anchor thanks for the help, I just noticed there's an error message , I had a misspelling in the http
aaaah, that is bad
Sometimes there is also a problem
with connections or something
It's there now thanks!
No problem!
nvm I ripped out the Wire stuff and replaced it with TinyWireM
idk if that's a kosher solution but it works
@vale anchor I'm not aware of that problem, but I don't really know how to test this either
SoftwareSerial seems to be working fine for me both ways
but there's always the issue of losing bytes as @north stream mentioned
I think software serial is great for any application requiring single byte data, otherwise you need to implement your own serial buffers and markers
I had to use a similar TinyWire hack when I was running a Crickit from a Trinket.
Does anyone know how to soft reset an M4 device in Arduino?
Hi, I'm trying to install teensyduino on Arduino 1.8.9 fresh installed, but my pc says something like "version.txt doesn't match". I'm running pop os 19.04. What can I do?
Correction: it says incorrect version format
@paper prawn Sure, plug the M4 device in and press the button on the board twice
This is will open up the bootloader and if you want you can for example flash it back to circuitpython
I am not sure if that was what you meant
Aah nevermind, you were talking about soft reset.
You can always attach an digital output to reset pin and just drive it high when you want to reset
Not the most elegant solution but it should work
@umbral bloom What does Contents/Java/lib/version.txt contain?
Oh well I got another issue now
I try to install teeonardu and it says this:
Hope it's readable
The GitHub about this says to upload this to get midi functionality
Cos I'm making a mini untztrument
@umbral bloom Seems like your made a mistake in your code
It's just pasted from www.pjrc.com/teensy/td_midi.html
Official teensy 2.0?
o nevermind
Why don't you use https://www.arduino.cc/en/Reference/MIDIUSB ?
or do you want USB host capabilities?
I'm just following what the mini untz guide says
I need teensyduino because I can upload midi code to it
If I don't then I can't upload
So you solved the problem?
Nope
You can't upload midi code to the MidiUSB library?
Tell you what I'll send a few pics of what happens when I try different stuff later
ok!
Does anyone know what the blink codes of the LED#13 on Adafruit Feather 32u4 are? The LED next to the BLE chip keeps flashing three long red pulses. I'm having some other problems with it, wondering if that's related
Between the MPU-9250 and the ICM-20948, which gyroscope would you guys recommend?
I plan to use it towards a rocketry flight computer
So performance and accuracy is necessary
@pulsar charm okay so I got my new power supply in and the thermal priter STILL wont print
I have no idea why I can't get it working
its the right voltage and right amount of amps
@full bronze I think 3 blinks means the Bluefruit module is in Command Mode.
the green light is blinking so the printer works
but its not feeding the paper out
okay So I tried my other usb printer but it prints gibberish
but at least it prints
@mighty elbow I haven't ran my printer in a couple of years, I could do a check for you later. What sketch are you running?
This is when I run the code from the mini untz
And I get the same errors every time
@pulsar charm I’m running the test sketch
I have both the original and usb thermal printer
The usb printer does print but it prints gibberish
The TTL (I believe it’s called) printer doesent print at all
But it works
The light goes on it’s just not spitting out paper
You used this code? @umbral bloom https://raw.githubusercontent.com/adafruit/TeeOnArdu/master/Examples/MIDI_IN_OUT/MIDI_IN_OUT.ino
For the second is from teensy's USB midi guide
@past token In the quadcopter scene it is generally believed that the MPU gyros are less noisy
Did you install Teensyduino itself?
Maybe this is the problem but I'm not sure https://playground.arduino.cc/Code/Bounce/
Maybe use the example supplied with the TeeOnArdu
Teensy also changed some stuff around if you go to the bottom of their midi page
@mighty elbow could you point me out to the particular model of printer you got from adafruit?
mine seems fine! you might have to switch the RX/TX pins, its strange but their library refers to the RX_PIN as matching the RX_PIN on the printer
mine was initially pushing paper but not printing (the opposite of your problem)
you could use the button beside the ledpin to check if paper is able to be pushed
I used an older larger reel and had to expend enough paper so that the roll could spin freely in there
@mighty elbow also try running the printer directly to a switching power supply first to make sure it isn't a power supply problem you are dealing with. I noted that mine drew a max of 1.5A when pushing paper
The mini usb one is printing but it’s printing garbage
I already messed around with the baudrate
It’s set at 9600
Which should be the correct rate
@humble anchor Yes I did install teensy duino
no idea why its printing out garbage
https://www.adafruit.com/product/2751?gclid=Cj0KCQjws7TqBRDgARIsAAHLHP6NRWN46-Cd8pF7MJnmMJbPL3w_nhq1TzSn1Mh-IYa63EFfrDQ1MeQaArU-EALw_wcB this is what i'm using
Add a really small printer to any microcontroller project with this very cute thermal printer. Thermal printers are also known as receipt printers, they're what you get when you go to ...
did you install the drivers? https://cdn-shop.adafruit.com/product-files/954/PL2303_Prolific_DriverInstaller_v1_12_0.zip
are these for the printer?
yeah it's on the product page
probably just the driverinstaller one
hope that helps
hmmm this is new
Invalid library found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers: no headers files (.h) found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers
Invalid library found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers: no headers files (.h) found in C:\Users\Hindenburger\Documents\Arduino\libraries\drivers
invalid library error
@mighty elbow so what's the problem with the serial printer
the usb-ttl one that I have
I can't tell you for sure what might be wrong for the mini-usb one because I don't have it
The serial printer won't feed paper out
the usb one prints but it prints a jumbled mess
the serial printer won't even print a test page when i hold the button down
its not supposed to print anything when you hold the button down, its just supposed to move the roller to feed paper
have you tried using just a bit of paper and see if the roller manages to push it?
like just run a sliver of your previously printed pieces through it
if it doesn't move its either your power output or its a faulty motor
Hey a question about the ds3231 rtc breakout:
I query RTC.now to update the struct. I call now.year, and it returns the correct value (I set the rtc using an esp module, pinging a nist server). However, when I call now.unixtime, it gives me a timestamp 3 years in the future according to epochconverter.com
Why is now.year correct, but now.unixtime is giving me garbage?
Update: I thought maybe some libraries were conflicting, so after removing time.h and timelib, it is now giving me a Unix timestamp only 4 months in the future lol
@pulsar charm tried that just now
nothing
can't be the power, i baught and am using the very power adapter you suggested a while back
I have 2 basically new printers that I cannot get working
this is frustrating
one does print but its not printing the test page
its printing jibberish
It's probably a bad motor then, contact adafruit? Have you tried to connect it to a switched mode power supply? Just run it at 5V and 2A. I didn't use the packaged adafruit power supply at all actually
the supply I'm using is 5V 2A
this is the model that is currently working for me its just printing random characters
Add a really small printer to any microcontroller project with this very cute thermal printer. Thermal printers are also known as receipt printers, they're what you get when you go to ...
so maybe if someone could help me how to get this one working?
Ok update: My ds3231 query code works perfectly on the Adafruit esp module, but the exact same code gives me a nonsensical Unix time on the Nano.
Anybody know where the error might be? Like is this a general compatibility problem?
Missing pull-up resistor?
Logic level mismatch?
@mighty elbow, you have two printers, and neither one will print the test page? How are you powering it on? Are you connecting the supply then plugging the supply into the wall, or are you plugging the supply into the wall then connecting it to the printer?
@north stream here’s how it’s setup: I’ve tried plugging the supply in the wall and connecting the printer and the other way around
This while holding down the button?
That's how you trigger a test page print.
Ok I think I found it; the timeLib and RTCLib functions break each other
Yeech I wanted to use timeLib
@north stream which method? Or does it matter if you plug it in one way or the other
I'm not sure if it matters, it may be an issue with the risetime of the voltage, so I'd try it both ways.
@mighty elbow I think videos/pictures would go a long way, your wiring, your setup, the components being used. I find most of my problems by just rubber ducking the problem
I’ll post some pictures next week and a video so you can understand everything clearer for sure
I'm working on an Arduino project and I have a problem.
The problem is that I cannot perform 2 things at the same time.
My idea is to charge up 4 LEDs and at the same time a servo goes to something like 20 degrees.
It's for this gun animation: https://www.youtube.com/watch?v=Mau7HQ86-Tk
Arduino Multitasking: https://learn.adafruit.com/multi-tasking-the-arduino-part-1 -- you'll basically have to rapidly swap back and forth between moving the motor a small increment and updating the LEDs.
@barren scaffold that's awesome!!!
The problem is that it's triggered when a button is pressed, just like the gun itself.
Maybe you can help me a little....
The same basic approach: you have the loop() function check each button you want to monitor, and if it's time to update LED or servo parameters. Something like ```c
#define DONE 0xfe
#define ENDSERVO 200
#define SERVOINC 20
#define SERVODELAY 80
#define ENDLED 0x0f
#define LEDINC 0x01
#define LEDDELAY 130
static int curservo;
static int curled;
static unsigned long nextservo;
static unsigned long nextled;
void
loop()
{
unsigned long curtime;
curtime = millis();
if (digitalRead(BUTTON_A) == LOW) {
// check for curservo == DONE for not retriggerable
curservo = 0;
setservo(curservo);
nextservo = curtime + SERVODELAY;
}
if (digitalRead(BUTTON_B) == LOW) {
// check for curled == DONE for not retriggerable
curled = 0;
setled(curled);
nextled = curtime + LEDDELAY;
}
if ((curservo != DONE) && (curtime > nextservo)) {
curservo += SERVOINC;
if (curservo >= SERVOEND) {
curservo = DONE;
} else {
setservo(curservo);
nextservo = curtime + SERVODELAY;
}
}
if ((curled != DONE) && (curtime > nextled)) {
curled += LEDINC;
if (curled >= LEDEND) {
curled = DONE;
} else {
setled(curled);
nextled = curtime + LEDDELAY;
}
}
}
Yep. Searching 'state machine arduino' should give good reference materials. https://www.instructables.com/id/Finite-State-Machine-on-an-Arduino/ shows something similar to the Adafruit one, and then moves on to this Yakindu software that lets you diagram and model the state machine ahead of writing code, but it looks like it requires Eclipse. Yakindu also appears to have some code-generation tools included to turn the state machine model into Arduino code.
Hi, I've got an issue with copying files from an SD card to a Feather M4's internal SPI flash. In the program I'm writing, I have a routine that is supposed to copy 27 different files from the SD card (inserted into a TFT Featherwing) to the internal flash, but it only copies the first 5 then just halts right when it starts the 6th. When viewing the internal flash in the Windows file explorer using the CircuitPython firmware, I can see that the first 5 files are there, the 6th file was created but is empty, and the drive label and all the default CircuitPython files that I left are gone. Could anyone help with this? I feel like there's something extremely simple and dumb that I'm missing :p
My code is here: https://paste.ee/p/dCQ7P (the routine in question is transferFromSDCard() on line 141)
I wonder if the file names come out even. Perhaps you're trying to read "6.sbi" and there's no file by that name (maybe there's a 06.sbi or somesuch). You might also try keeping the filesystem descriptors open instead of closing and re-opening them (there could be some weird caching behavior). There's a chance that the TFT updates are somehow causing issues with the SD/flash interactions. You could try adding some debugging (perhaps serial so if it is a TFT issue, you can catch it). Maybe count the transfers in the while loop and report that?
From a quick test I did, the code is able to catch if it's trying to read from a file that doesn't exist. I did try removing all TFT functions and having it only report over serial, and now it stops at 0.sbi at byte 33792. What's weird is that when it stopped, I wasn't able to interact with or close the serial monitor at all
I tried again after reformatting the flash with the circuitpython uf2, and this time it stopped at 4.sbi at byte 34816. You might be right with there being some kind of weird caching stuff going on?
Heck, that last attempt totally messed up the flash
Can someone please help this newbie out. I am working with a YUN shield ( dragino ) and trying to get it to save some data to the USB. I have tried everything I can find in the CC forums but to no avail.
I can access the http://192.x.x.x/sd and see files that I put there manually.
I have tried every option I can think of for the save path :
I tried some code from the public domain :
http://www.arduino.cc/en/Tutorial/YunDatalogger
What do you want to do exactly? @rigid roost
One thing you must understand is that this code isn't run on the Yun Shield, so that you can see the sd card in the browser doesn't mean the Arduino can see it
What you can also do as an work around is to make a program that runs on the Yun, https://www.youtube.com/watch?v=whI_kRlm8Sg
Tutorial about how to run Python on an arduino Yun Link to arduino code: https://create.arduino.cc/editor/LogMaker360/1dd219e2-053c-416f-8f97-ed3e60f7c25c/pr...
and reads the sensors from the Arduino, instead of having the arduino send data to the yun shield
Hi Bonnom. I will research the yun-code option. At this point anything is helpful. I am trying to record several digital and two analog inputs every 5 minutes to a file, and then every 30 minutes ftp that file to a web server. At the beginning of the project the Yun seemed like the ideal wifi device to use.
My code runs on a Uno, and uses the bridge library to communicate with the yun. I can upload the arduino code via wifi through the yun, so the only part that appears not to be working is saving files to the USB.
Files to the SD works? @rigid roost
The great thing about programming the Yun instead of the Arduino is that you can eventually do more advanced stuff like webpages
yeah the dragino Yun shield does not have SD, only USB. the original Yun board has a microSD on the bottom. I liked the idea of it serving its own pages. I am experimenting with power supply now, as the Yun will not run successfully using usb power on the Uno.
Earlier Dragino shields did have them.
So basically you need code to that writes to USB instead of microsd
Surprisingly hard to find stuff about that
I think I got it
I think this is a job for a raspberry pi
Can you get to the root of Yun filesystem? @rigid roost
File dataFile = FileSystem.open("/mnt/sd/datalog.txt", FILE_APPEND);
This line writes to the sd card
but instead of "/mnt/sd/datalog.txt" you must change it to something like "/mnt/MYUSBDRIVE/datalog.txt"
Where myusbdrive is the name the yun gave your drive
Ok you see 'Mount Point'
You must change sd with sda1
In the example from Arduino
yes, I have tried all combinations of /mnt/sda1/datalog.txt
I have created the /arduino folder in the root, and the yun symbolically links it to /sd
which I know is working as I can browse the /sd folder and see files I have manually placed in the /arduino/www folder.
Yun Shield set up /www/sd
can you try '/mnt/sda1/arduino/datalog.txt'?
Otherwise I'm out of ideas
I don't see any commands in Bridge to see if connection between Yun and Arduino is succesful
yes tried that path. the connection must be successful as I can upload the sketch via wifi through the yun. Its doing my head in. Been on it for a couple of weeks on and off.
Yeah, I don't understand it either. I would personally just try python at this point
I am having trouble using an M4 metro to perform I2C comms with an IMU (tried both BNO055 and FXAS2100) - I download example program using arduino-ide and once it starts to run it disables the COMM port connected to computer USB. Tried on a few computers with same result. This used to work fine on a plain Metro. Any ideas?
Also, If I use CircuitPython it works as expected - trouble is I can't use CircuitPython for this project - need time critical code execution and use of interrupts.
Official Adafruit library?
yes
Did you also install Adafruit Unified Sensor Driver?
yes
trying to use the sensorapi examples
I have even tried putting in pull-up resistors just in case
If you lose the comport how do you flash it again?
Reboot manually into the bootloader?
disconnect the SDA line or power down the imu
then the device reboots to look like its a drive to have bootloader installed
Owwww, check the wiring
Does the COM port get removed when you connect the sensor or when you flash the program?
I have even tried connecting to A4 and A5 with the same result
COMM port dies when I connect the sensor
With Wire.Begin(A4, A5);?
different code, but yes
Usually a 'com port dies' if there is a short somewhere, but strange that it worked with circuitpython
Basically the entire device shutsdown
I was thinking their may be an addressing issue - so I tried changing the I2C from default - but got the same result
Yeah, and when connecting SDA and SCL on the board should work just fine
SCL - the I2C (Wire) clock pin. There's no pull up on this pin by default so when using with I2C, you may need a 2.2K-10K pullup.```
You also did that
the IMU boards have their own pull-ups
This is from the M4 Metro pinouts page
but to answer your question I tried it with no difference
Can you also try using pin 2 and 3?
Or connect the i2C device to 2 random ports and see what happens
If it shuts down aswel
That it works all right on circuitpython and not on arduino without changing anything, I would post your question here: https://github.com/adafruit/ArduinoCore-samd/issues
I plugged SCL/SDA from the IMU board into A2/A3 and things are still running
It is a really odd issue and has been perplexing me for a 2 days
Yeah, report it on the Adafruit ArduinoCore-samd, especially mention that it works just fine on Circuitpython
With a copy of the example code just to be sure, and connection diagram.
ok, thank you
or connection in words
going to reverify that circuitpython does still work, Friday was a mess, when I tried to change the bootloader back to arduino-ide, my comm ports on computer stopped workgin properly and required a reboot
Good idea!
In my experience when COM starts disappearing there is an short somewhere
please we send a code for oled screen serial text writing
@feral pivot that sentence doesn't make much sense. What do you mean?
ı m need make a watch with arduino but ı cant write time to oled screen
Is the connection between the oled and arduino: serial, i2c or spi?
I2C connection ı can connect arduino and oled screen but ı cant write real clock data
and ı sorry my english is very bad
You can write stuff like 'Hello' on the screen?
does anyone know of a true random gist/library for arduino
ım used demo test code ı cant write nothing
@feral pivot can you show us a photo of your wiring?
@pulsar charm Why do you need true random?
@humble anchor Trying to mock some sensor output (because I didn't bring it home)
I wanted to do something like that:
void mockIonCount() {
if (hue == 0) {
hue = random(50, 180);
}
else {
int8 rand = random(-2, 3);
hue += rand;
}
}
But I realized that rand runs on a moving average
wait please
Aah, you not looking for true random but a good random number generator
Have you tried randomseed?
It gives the same result everytime but it might do what you need
not ım write real time data only
Sorry was talking to @pulsar charm !
@humble anchor Yeah I have, but should I be running it everytime I generate a random number?
I'll often use something a little unpredictable (reading from an unconnected analog pin or two) to seed a pseudorandom generator so it at least won't give the the same sequence every time.
You just want to have some example data right? People usually use randomseed
You can also use random with in randomseed
let me try that right out right now
tragic, its still not random 😦
void mockIonCount() {
if (hue == 0) {
hue = random(50, 180);
}
else {
randomSeed(analogRead(A0));
int8 rand = random(-2, 3);
hue += rand;
}
}
and this is my output
251
137
157
177
197
217
237
123
The Arduino programming language Reference, organized into Functions, Variable and Constant, and Structure keywords.
I think it might have something to do with the fact that I'm using a task scheduler
There is an example
I've seen that, and I've got that in my setup as well
it doesn't seem to be doing anything
Do the randomseed in the setup only, I think
yeah It's been actually in my setup this whole while
bah! Perhaps I should abandon mocking
its such bad code practice
I tried both to be honest
hmm
wait I found another stray randomSeed
let's see if this is the culprit
In the code you send, you did have the randomseed in a weird place
ah ha!
its fixed
@humble anchor you're a lifesaver!
yeah ... I thought so as well
time to fire up my mesh experiment ⚙
No problem!
I'm working on programming a Trinket m0 with Arduino. When I go to upload the sketch, the trinket goes into bootloader mode (RGB led showing green) but arduino gives the error message sam-ba operation failed. Then, for the next 10 seconds or so, when I try to upload the sketch, i get a port busy error message. After that the sketch uploads without an issue. Does this have to do with the CircuitPython bootloader at all? (I'm totally fine with removing it completely). Would it help to use the burn bootloader tool in the arduino ide?
I'm having an issue with an Feather Adalogger 32u4, I bought a dozen about a month ago, and having been using them slowly for a work project. All the other ones have worked perfectly, but when I opened a new one today, it seems dead. The battery charge led lights up, but no others, and it doesn't show up as a com port when I plug it into the computer. I have confirmed that it is a data USB cable. I have also tried all of the fixes on the feather help page, to no avail.
Am I missing something, or is it really dead?
hello multi vers im trying to measure voltage using a voltage divider without using the arduinos drive voltage as a reference is this possible google is failing me today :/ ?
I'm not sure what you mean by using drive voltage as a reference. The Arduino has a couple of available reference voltages for its ADC circuitry, are you just using the default one?
i folowed this video https://www.youtube.com/watch?v=THB-pi8w7Qw
Measure up to 30 volts by an Arduino using the analog input. Another easy to build project, First I will cover voltage dividers and how to use them to safely...
In any case, you can use a voltage divider to measure voltage.
yes so he uses a voltage devider and then uses the arduino drive voltage to figer out a caebration voltage :/ but it meens if the drive voltage chages your output dose
I'm still not sure what you mean by drive voltage.
Perhaps the power supply voltage?
Generally you can just calculate the calibration, unless you're looking for higher accuracy.
yes supply voltage . iv not found away to cacluate it as of yet :/
heres ther code the guy in the video ses to use float val = analogRead(A0);
float in = (val * 5.0) / 1024 ; // the end reading is linked to the power
float output = (in*2.020833333);// calibrationb voltage needs taking on new circut
Serial.println(output);
Anyone know of a way to ensure an Arduino boots even with a connection to the RX pin present?
I'm guessing the first expression calculates the voltage at the pin, and the second one scales it to match the voltage divider (but it looks like it's backwards to me).
it might be ill have to keeo looking
Nah, you have all you need, just that code makes things look more complicated than they are.
Just replace the second one with an equation to match your voltage divider (calculated from the resistor values) and you're done.
Something like ```c
float rlower = 1000.0; // 1kΩ lower resistor in voltage divider
float rupper = 10000.0; // 10kΩ upper resistor in voltage divider
int val = analogRead(A0);
float pinVoltage = (val * 5.0) / 1024; // calculate voltage at pin
float scaledVoltage = (val * (rlower + rupper)) / rlower; // calculate voltage into voltage divider
hmmm think i tryed somthing like that before with no look ill go give it ago
This is what I followed to create a voltmeter https://www.electroschematics.com/9351/arduino-digital-voltmeter/
Note I had misremembered the equation so I edited my code above to be correct.
Unfortunately, "no luck" doesn't really give a useful starting point for debugging. What happened? Did it compile? Did it crash? Did it give the wrong value?
i don't appeared to be getting it scaled right :/
float r1= 10000;
float r2 = 10000;
void setup() {
Serial.begin(9600);
}
void loop() {
float val = analogRead(A0);
float in = (val * 5.0) / 1024 ;
float out = (val * (r1 + r2 )) / r1;
Serial.println(out);
delay (1000);
}
5v = 1022 on the serial print
@sinful saffron thanks for the link i had already found that still no look i think im just missing something i might go to bed and try again in the morning
are all the resistors correctly placed, and the pins correctly assigned
ye from what i can tell
Think this is what I had that worked
int voltageInput = 0;
float vout = 0.0;
float vin = 0.0;
float R1 = 92000.0; // resistance of R1 (100K) -see text!
float R2 = 9500.0; // resistance of R2 (10K) - see text!
int voltageRead = 0;
void setup() {
pinMode(voltageInput, INPUT);
}
void loop() {
VoltageRead();
delay(1000);
}
void VoltageRead(){
// read the value at analog input
voltageRead = analogRead(voltageInput);
vout = (voltageRead * 5.0) / 1024.0; // see text
vin = vout / (R2/(R1+R2));
if (vin<0.09) {
vin=0.0;//statement to quash undesired reading !
}
}
i changed the math still no look its very late here im going to head to bed try again in the morning thank for your help
alright, I'd just double check with the schematic when you get a chance
good luck with it though
Might not have the voltage divider grounded properly
35 votes and 5 comments so far on Reddit
Has anyone used ATmega 328PB with Arduino? Is it possible to use second I2C, SPI and UART?
The UART does seem to work according to Pololu @mild elk
But the hardware i2c and spi are not implemented
This is bad news, I was planning to use this microcontroller from now on
You need 5V?
But first I2C and SPI do work?
Very likely
Ok, at least this is good
No, it doesn't have to be 5V
3.3V is also fine
But why do you want to use this chip in particular?
Why do you need two i2c and spi?
Dual I2C is useful if you have two ICs with the same address and want to use both in a project. For example DS3231 and MCP3421 have the same address and can't be used on the same bus.
@humble anchor
I just use an TCA9548A in that case
But I agree it is more elegant to have two channels
That's why I was hoping it will be supported
To bad that the new ARDUINO NANO EVERY doesn't have two i2c channels
I have to do a little bit of research on how wire library works to maybe write some simple code for second channel on PB
Maybe this example helps: https://github.com/espressif/arduino-esp32/issues/977
Please fill the info fields, it helps to get you faster support ;) If you have a Guru Meditation Error, please decode it: https://github.com/me-no-dev/EspExceptionDecoder --------------------------...
Yeah, this might be helpful
I'll start working on it as soon as I get my hands on 328PB
But I think the problem might actually be in the Arduino core for the Atmega328PB @mild elk
Why?
I am not sure, but I think they have to add a second i2c interface in it
🤔 yeah, I'll definitely how to look into that. But first I'll get the chip and get it up and running on my breadboard.
But why not use a chip that does have build in support for multiple i2c channels?
Like? Give me some examples
https://forum.pjrc.com/threads/21680-New-I2C-library-for-Teensy3, I have not tested it myself
Hello all,
December 2, 2018:: As below see github for the latest download and details - the ZIP below is old …
This thread details an enhanced I2C library for the Teensy 3.x, and LC devices (it does not support AVR based Teensy devices). The historical content...
Also that github link I send you earlier about esp32 and two i2c channels
https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/creating-a-new-wire,
I have not tested this one but probably other people here have
I thought there were problems with the SAMD21
Honestly I don't know 😂
I really like 328 and feel like it still has a lot of potential I'm not using. I don't need anything more powerful, I just thought it would be nice to have some added functionalities like additional timers or serial ports.
To be honest it is a bit strange that 8-bit chips are still popular
Why do you think so?
There are some applications where you don't need 32 bit CPU
And they are very easy to work with because they come in packages that you can solder yourself and not sometging like 100 pin BGA
Honestly I think it's a shame that 328PB doesn't come in DIP package
Because they are not necessarily more expensive or come large packages
I'm not considering the price here
Then please tell me exactly which non-8bit CPU i could solder myself
Maybe you even convince me to leave 328
@pulsar charm I suspect a bunch of folks here own Teensys. I know I do.
NXP and others used to offer DIP packaged 32-bit ARM CPU chips (including one in an 8-pin DIP), but I think they've all been discontinued by now.
The new teensy 4.0 is pretty nice but it doesn't have analog output, and is fairly new. Not sure if it has the extra i2c channels implemented yet.
I like the ESP32 for a bit, but something can sometimes be a bit hard. For example the weird PWM commands.
The esp8266 is very popular and there are some sellers that sell boards at a really low price.
The esp32 and esp8266 also have wifi, the esp8266 has only one analog in port
Ok, but let's say I want to build a wrist watch. I can't quite wear teensy on my hand, ESP32 is too big and ESP8266 is QFN package which I can't solder
You probably can if you are willing to learn and not have any physical limitations to do it
So, you want something smaller than an ESP32, big enough to hand solder, and has wireless connectivity?
No, smaller than ESP32, big enough to hand solder and with two I2C interfaces
Is software I2C acceptable?
You can get ESP32 and ESP8266 modules
No, I'd like a hardware port
ESP8266 doesnt have 2 i2c ports but the esp32 should have them
esp32-wroom module is pretty small, but might be to big
MSP430F5232?
There is also the https://m5stack.com/products/stick-c
But that is more of a prebuild thing
Why two I2C ports? You can parallel I2C client devices on the same bus.
But if you have two ICs with the same address you can't
You know that you can order a MCP3421 with a different adress right?
That's awkward. You could use an I2C multiplexor, but that's a whole additional chip.
Yeah, that's probably the solution
An esp32-wroom module is to big?
Yes
I ended up using an MSP430FR5969 once when I needed a bunch of serial and SPI ports.
I think the uChip would have been a board to your liking but to bad it didnt succeed
They are going to release it soon on their website https://www.itaca-innovation.com/
It is basically a SAMD21 development board in DIP package
@north stream is using the teensy fairly straightforward? I currently don't have a need to drive 4000 leds at once, but I'm thinking of saving up for some hardware to drive much larger led matrices
Yeah, the Teensy is pretty easy to set up and use. I've built them into a bunch of projects.
Time to add another board to the family then!
speaking of the teensy, just got mine set up right now!
it's smaller than the arduino nano... they weren't kidding when they called it teensy
Trying @adafruit 1.3" TFT (240x240), with ST7735 library modified to use 40MHz SPI frequency on Teensy 4.0. https://t.co/ctcH0lkioN
t
Hello arduinites I'm having some trouble and am in need of some help.
I'm trying to create a device that reads a csv file from an sd card with times recorded on it, subtract the two times to determine a delay then send an a digital pulse to a mosfet to activate something else and finally take a temperature measurement from a thermistor and write it to a DIFFERENT file on the SD card.
Where I'm having trouble is opening and closing the two files on the SD card. How do I do this? I'm somewhat experienced in arduino but nothing crazy and I just cant figure out why I can't understand what I'm doing wrong.
Why does this not work?
#include <SD.h>
#include <SPI.h>
/* CSV File Reading */
File file;
int SC = 10; //SC - Pin 53 Arduino Mega
char location;
long x;
//int e = 0;
long delayTime;
long readValue1 = 0.0;
long readValue2 = 0.0;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
//SD Card Reader Setup
Serial.begin(57600);
if (!SD.begin(SC)) {
Serial.println("begin error");
return;
}
}
void loop() // run over and over
{
file = SD.open("datalog.CSV", FILE_READ);
if (!file) {
Serial.println("open error");
return;
}
readSD();
delay(delayTime);
file.close();
}
bool readLine(File &f, char* line, size_t maxLen) {
for (size_t n = 0; n < maxLen; n++) {
int c = f.read();
if ( c < 0 && n == 0) return false; // EOF
if (c < 0 || c == '\n') {
line[n] = 0;
return true;
}
line[n] = c;
}
return false; // line too long
}
bool readVals(long* v1) {
char line[200], *ptr, *str;
if (!readLine(file, line, sizeof(line))) {
return false; // EOF or too long
}
*v1 = strtol(line, &ptr, 10);
if (ptr == line) return false; // bad number if equal
while (*ptr) {
if (*ptr++ == ',') break;
}
//e += 1;
return str != ptr; // true if number found
}
void readSD() {
readVals(&x);
readVals(&x);
readValue1 = readValue2;
readValue2 = x;
delayTime = (readValue2 - readValue1) * 1000;
Serial.print("Delay Time:");
Serial.println(delayTime);
}
And this DOES work?
#include <SD.h>
#include <SPI.h>
/* CSV File Reading */
File file;
int SC = 10; //SC - Pin 53 Arduino Mega
char location;
long x;
//int e = 0;
long delayTime;
long readValue1 = 0.0;
long readValue2 = 0.0;
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
//SD Card Reader Setup
Serial.begin(57600);
if (!SD.begin(SC)) {
Serial.println("begin error");
return;
}
file = SD.open("datalog.CSV", FILE_READ);
if (!file) {
Serial.println("open error");
return;
}
}
void loop() // run over and over
{
readSD();
delay(delayTime);
//file.close();
}
bool readLine(File &f, char* line, size_t maxLen) {
for (size_t n = 0; n < maxLen; n++) {
int c = f.read();
if ( c < 0 && n == 0) return false; // EOF
if (c < 0 || c == '\n') {
line[n] = 0;
return true;
}
line[n] = c;
}
return false; // line too long
}
bool readVals(long* v1) {
char line[200], *ptr, *str;
if (!readLine(file, line, sizeof(line))) {
return false; // EOF or too long
}
*v1 = strtol(line, &ptr, 10);
if (ptr == line) return false; // bad number if equal
while (*ptr) {
if (*ptr++ == ',') break;
}
//e += 1;
return str != ptr; // true if number found
}
void readSD() {
readVals(&x);
readVals(&x);
readValue1 = readValue2;
readValue2 = x;
delayTime = (readValue2 - readValue1) * 1000;
Serial.print("Delay Time:");
Serial.println(delayTime);
}
With the first portion my delayTimes are always 0, with the second one the difference comes out properly every time
This is my Example file. I'm only really using the first column
I legit thought that said help with Arduino but I was wrong, I just pasted what I said there,in here
But could someone help me?
I cant think how to do this
@warm zinc I think you should look into relay boards
maybe ill do it when i get more experience programming in c++ and arduino, im really new to this
i just got my kit yesterday
Do these offsets look normal for MPU-6050 calibration?
The accZ axis looks concerning
@warm zinc responded in the other channel, but yeah, need a relay.
okay, maybe i should do another project for beginners..
let me solder the dang fan back together now
@carmine sun the problem with the first program is that you are always reading the first line of the CSV. Every time you open the file, you start reading it from the beginning.
To fix this, you can use File.seek(position) to change the position in the file you are reading from
omg thank you! is position just an integer? @woven mica
and does it read down the whole file or does it go line by line? My file will be several thousand lines long.
The position is an integer - its value means how many bytes far from start of the file
ah dang, wont that slow my program down if it has to count a bajillion bytes before it gets to the one I want
You can save your last position in a variable every time you read a line
And then next loop just seek to it
oh great is that just File.position() ?
yes, that should be it
I'll give it a shot! if it doesn't work do you mind if I ping you again for input later?
Well, I am going offline soon, but tomorrow you can ping me
okay cool thanks
You're welcome
does anyone know any good tutorials that go in depth about c++?
Hello again, I'm still having trouble with the problem I previously stated. @woven mica suggested using file.seek and file.position but my data is not in a fixed width format and I'd have a hard time reading from it. Are there any other suggestions for methods to read specific values from a csv file on an sd card?
If you have irregular line lengths the only simple option for getting line X is to read the entire file up to that point.
what is your goal? do you need to read a random line in the file or always at the end or something else?
random == arbitrary
I'm trying to create a device that reads a csv file from an sd card with times recorded on it, subtract the two times to determine a delay then send an a digital pulse to a mosfet to activate something else and finally take a temperature measurement from a thermistor and write it to a DIFFERENT file on the SD card.
so you always start at the beginning of the file and need to handle every line?
in order
yes, I need to grab the first value of every line as a number
but if I made an array populated with thousands of values I'd run out of space very quickly
^that's a shorter, sample of the file I'll need to read
I think you should be able to open the file for reading at the beginning and never close it. Read a line, do stuff, repeat
do stuff would include saving the current value to be used as the previous value in the next iteration.
ah but you see, I need to read from 1 file and write to another and arduino does not like having the file open all the time. also if I lose power suddenly and have't closed the file I loose all the data I was gathering
you should not lose data in a file opened read-only.
but I will in the one I am writing to. Remember I'm writing to one file and reading another
call file.flush() on the file you are writing after each data point is written.
would there be anyway to send shutdown signal to Odroid HC1 via UART ?
@warm zinc You asked about learning C++. In the context of Arduino, this is probably a good start for you:
@carmine sun sounds like a rasberry pi would be better tool
Hello! I created 100 custom pcb around samd21 and w5500 Ethernet chip. Now I'd like to create unique ip/mac from the samd21 serial. In the datasheet they say
Each device has a unique 128-bit serial number which is a concatenation of four 32-bit words contained at the following addresses:
Word 0: 0x0080A00C
Word 1: 0x0080A040
Word 2: 0x0080A044
Word 3: 0x0080A048
The uniqueness of the serial number is guaranteed only when using all 128 bits.
And with the teensy I use https://github.com/FrankBoesing/TeensyMAC
Any idea to achieve something similar ?
Regards
Here is the PCB for the curious
Hi Peeps, I'm a beginner and in a bit of a pickle. I have a RTC module connected to a UNO, I'm able to have it post the time to the monitor though I'm trying a "If statement and it's just not working. Any help would be greatly appreciated
String ReadTimeDate(){
String temp;
int TimeDate [7]; //second,minute,hour,null,day,month,year
for(int i=0; i<=6;i++){
if(i==3)
i++;
digitalWrite(cs, LOW);
SPI.transfer(i+0x00);
unsigned int n = SPI.transfer(0x00);
digitalWrite(cs, HIGH);
int a=n & B00001111;
if(i==2){
int b=(n & B00110000)>>4; //24 hour mode
if(b==B00000010)
b=20;
else if(b==B00000001)
b=10;
TimeDate[i]=a+b;
}
else if(i==4){
int b=(n & B00110000)>>4;
TimeDate[i]=a+b*10;
}
else if(i==5){
int b=(n & B00010000)>>4;
TimeDate[i]=a+b*10;
}
else if(i==6){
int b=(n & B11110000)>>4;
TimeDate[i]=a+b*10;
}
else{
int b=(n & B01110000)>>4;
TimeDate[i]=a+b*10;
}
}
temp.concat("Date:") ;
temp.concat(" ") ;
temp.concat(TimeDate[4]);
temp.concat("/") ;
temp.concat(TimeDate[5]);
temp.concat("/") ;
temp.concat(TimeDate[6]);
temp.concat(" ") ;
temp.concat(TimeDate[2]);
temp.concat(":") ;
temp.concat(TimeDate[1]);
temp.concat(":") ;
temp.concat(TimeDate[0]);
if (temp.concat(TimeDate[4] > 13)) ;
Serial.println("Yes") ;
return(temp);
}
Just a little formatting
String ReadTimeDate() {
String temp;
int TimeDate [7]; //second,minute,hour,null,day,month,year
for (int i = 0; i <= 6; i++) {
if (i == 3)
i++;
digitalWrite(cs, LOW);
SPI.transfer(i + 0x00);
unsigned int n = SPI.transfer(0x00);
digitalWrite(cs, HIGH);
int a = n & B00001111;
if (i == 2) {
int b = (n & B00110000) >> 4; //24 hour mode
if (b == B00000010)
b = 20;
else if (b == B00000001)
b = 10;
TimeDate[i] = a + b;
}
else if (i == 4) {
int b = (n & B00110000) >> 4;
TimeDate[i] = a + b * 10;
}
else if (i == 5) {
int b = (n & B00010000) >> 4;
TimeDate[i] = a + b * 10;
}
else if (i == 6) {
int b = (n & B11110000) >> 4;
TimeDate[i] = a + b * 10;
}
else {
int b = (n & B01110000) >> 4;
TimeDate[i] = a + b * 10;
}
}
temp.concat("Date:") ;
temp.concat(" ") ;
temp.concat(TimeDate[4]);
temp.concat("/") ;
temp.concat(TimeDate[5]);
temp.concat("/") ;
temp.concat(TimeDate[6]);
temp.concat(" ") ;
temp.concat(TimeDate[2]);
temp.concat(":") ;
temp.concat(TimeDate[1]);
temp.concat(":") ;
temp.concat(TimeDate[0]);
if (temp.concat(TimeDate[4] > 13)) ;
Serial.println("Yes") ;
return (temp);
}
@frozen marlin shouldn't the return function not have temp in parentheses
like:
return temp;
also you didn't put any operations in your last if statement. it just sits there
All good guys, figured it out
It's commented out now but yeah :/
Only reason I wanted to be able to hit it is so I can place the uno to sleep when I'm ready to code that in
@carmine sun for the formatting, do you mind if I ask how you did that
Thanks*
Thankyou 🙂
try it out in dm with yourself or a trash server it works everywhere
also if you have extra long code use pastebin
That was my next question haha
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Anyone familiar with the DS3234 (Sparkfun RTC Module). I have it all running fine but I'm not quite sure how I can just get it to run on the battery and not the 3.3 from the UNO?
I have read DS3231 datasheet (the same chip but with I2C) and it says that it will work on Vbat if you just simply start communication with it so I assume it might be the case here as well. Give me a sec I'll get DS3234 datasheet
@frozen marlin
No, seems like I was wrong. DS3234 isn't accesible when powered with Vbat.
But I was right about DS3231: it CAN operate on Vbat.
I'm just not sure why would you want to run the chip from battery when external power is available
Also DS3234 should run on 5V just fine
I've adopted a library (the Adafruit_Thermal library) into my codebase so that I can modify it instead of editing the original. My goal is to fit it onto an ATTiny85.
For the project I'm working on I know there's a bunch of stuff I don't need like printing barcodes, character sets from languages other than english, etc, so those are easy wins.
My question is more of a fundamental arduino/cpp one: what kinds of stuff can I remove to save space?
Like I know that removing comments won't affect the space b/c the compiler rips them out, the pre-processor stuff like #define doesn't make a difference b/c by the time you're at compile those constants have already been replaced with their values (right?). Is there good stuff to look for chopping out to save space? Does stuff like shortening variable or method names make a difference (it doesn't because when it's compiled down to assembly it doesn't use the var names anyway, right)?
I'm assuming removing overloaded methods that I know I'm not going to call will help, correct?
variable names shouldn't matter. I seem to recall there being a difference between using flash RAM and the other kind of RAM (can't remember the term) to store things.
I'm using trinket m0 does it matter what ide programmer I use?
I have a question: do You know if I could use additional functionalities on ATmega328PB by directly accesing the registers? I have a core installed that claims to support 328PB
@elfin kiln Arduino IDE is usually the easiest but other IDE's will work (eg. VSCode, Atom )
I know at least in the case of VSCode plugin that it requires the Arduino IDE and basically is a VSCode wrapper around that
As much as I love the VSCode editor, I personally found the combination a touch overwhelming and went back to the Arduino IDE
@elfin kiln I use PlatformIO in VSCode and since using it I have never gone back to Arduino IDE. Personally I like the autocomplete it offers more than anything else, but it also has the benefit of not having to install various boards from the board manager as they are already added, much better file organization, and the ability to have your own formatting options just to name a few. I am by no means a professional programmer, or even an experienced one, and at first I did feel a touch overwhelmed, but the benefits of it outweighed the challenge for me.
@frank linden wow, that looks a lot nicer than the plug-in I used previously. Does it automatically support Adafruit boards?
And does it have an integrated library manager?
@crystal mesa yes, and yes
its essentially a wrapper built over the arduino-cli
getting libraries into your projects requires you to get a little more hands on
it has an integrated library with semantic versioning, that allows you to revert versions (like I had for the latest FastLED release that was breaking APA102 code) much easier than Arduino IDE, the catch is that the ones in the integrated library need to be registered, so not all are there
you could clone your one-off libraries into your projects, or manually expand your library include path to include your current arduino libraries filepath (ie ../Arduino/libraries) per environment that you are working on
its definitely a more fully-featured IDE over the Arduino IDE, and requires you to be more hands-on with fiddling about the platformio.ini file
@crystal mesa Hope @pulsar charm answered your questions. The things to look out for when getting started with PlatformIO is to always '#include <Arduino.h>', use function prototypes if you declare the function after your code, and if you use a baud rate other than 9600 to declare it in platformio.ini as 'monitor_speed = 115200' or whatever speed you want, all of which Arduino IDE handles normally but outside of Arduino is very uncommon, and good code practice to get into. That will get you started with it and I hope you enjoy it as much as I have.
@frank linden @pulsar charm I have downloaded it and am evaluating it right now.
Hi guys, quick question!
I'm trying to read the temperature value from my MPL3115A2 sensor
Okay, is it just me, or does PlO not support the Feather Huzzah??
Which register do I need to request from to get the temperature value?
That would be the datasheet, on page 19 is where it lists all the register values
But there seems to be multiple registers related to temperature
Or should I disregard getting raw temperature values using Wire.h and just use the supported library instead?
@crystal mesa have you downloaded the cores for esp8266?
@rain horizon are you sure COM4 is the right port ?
Always read error messages carefuly because they usually tell you what the problem is
@mild elk Thanks kactus, I want to run it from battery so I can interrupt wake the arduino (battery powered to conserve power.
This doesn't require the clock to run from battery. When arduino is sleeping it still needs power. Very little, but still. Battery is usually used to keep time when system power is discontinued ( when you unplug your arduino )
@frozen marlin
Also: how does your sleep function work?
I place the Arduino to sleep using LowPowerDeepSleep, using the RTC as a interrupt. Under DeepSleep I thought that it would not supply enough power for the RTC hence why the battery comes with one.
(I should note I am new to Arduino)
does anyone know where the interrupt pin is located on a teensy4.0?
"All digital pins have Interrupt capability" according to that image
@frozen marlin the CPU isn't responsible for power delivery on the board. 5V is drawn from USB, 3.3V form onboard regulator which also runs from USB. Power will be available regardless of what is CPU doing. Your clock will still run even when CPU goes to sleep.
@solar sail thanks! didnt notice that
Hi all, is anybody available to give me assistance or guidance on how to create a specific thing for my project? its kind of detailed so i don't wanna bore everyone, all i'l say is its going into a power armour suit 😉 if anyone would be willing to help please can they let me know so i can brief them, thanks and sorry to disturb y'all 🙂
Might as well start with a couple of details on what you think is most pressing right now, and post to the channel, either people will have suggestions or not.
@half glacier if its not arduino centric then maybe #help-with-projects is a better place. But don't worry about boring anyone, people can just scroll past if they aren't interested.
well i wanted to try and set an arduino up so as it boots up or whatever it uses a camera and has a live feed to a screen, without using wifi or anything? as well as putting an overlay over the top of the camera output on the screen. im not sure how it would work but that's why im askin you geniuses 🙂
@half glacier I don't really have experience with it. One problem is that a lot of cameras are really bad images.
What type of screen do you want? Like a large display or something small?
Yeah thays the idea, its mean to be a grainy, scratchy ish image
And a small one
Maybe car satnav sized? It's to attempt to fit in a power suit helmet, if it dont work I'm gonna make up a board and jabe it all connected so I can understand how it works too, like a test rig
Yeah, using a larger screen wouldn't be in the scope of arduino
There is a Sipeed MAIX bit kit with LCD and camera available. It is relatively new and not very popular but it should be able to do it.
It might be a bit of a tricky project
This sounds much more like a job for a Raspberry Pi, a Rasp Pi Zero could probably do it. I say this both because a Raspberry Pi has a camera port and video port, and is much closer to a computer you would normally use to do such a thing with, just a thought.
I have a rpi with the camera module on at the moment, but it's just the same issue of struggling to understand code or any of the smart guy stuff lmao
Yeah Raspberry pi zero W is probably an easier option but that one doesn't have a buildin display connector, but you can try like a SPI screen.
Like 4 inch 320 × 480 pixels with SPI
The 'smart guy' stuff is usually just finding the right libraries
It would be a lot easier if OBS was on the raspberry pi
Basically you can easy overlays on that
https://www.youtube.com/watch?v=S3zNBGfPFxI take a look at the description of the video it might help @half glacier
Make your own live streaming setup on the cheap with this kit and a little DIY inspiration. It works great and can get you started on YouTube / Twitch stream...
Doesn't use OBS, that would have been so much easier
Brilliant, il watch it later- as long as I doesn't require wifi connections at all then it should be fine
Space wise, it dont matter how much it takes up since this suit is around 8ft
I've seem on the rpi you can open camera view as a demo shot almost but idk any ways of keeping it open or making it open upon boot. Anyway this is arduino based chat so my apologies :)
Thanks for the help though!
Any Pi will have a lot more room to play with than an Arduino on video, yes. I have an 800x480 screen (Hyperpixel) hooked up to all the GPIO pins on my Pi Zero W, and it runs Chrome and a light JQuery page without problems. Boots into a desktop and starts Chrome automatically. That could turn your overlay problem into a web programming exercise, if you can get the camera feed onto the web page. The web page doesn't have to be on another system, could be local to the Pi.
@half glacier why not just skip the code all together and run a wire from the camera to the screen? Fpv drone gear is cheap, cameras, lcd screens, etc
Thanks @mild elk
the more i do embedded programming in C, the more i realize just how much i don't know about computers
how 2 not feel lost
C is one of those things that I had to grow new wrinkles on my brain for (especially being my first programming language)
Because I initially wanted to see I'd j ciud have it open it from boot up to go to a camera with a custom overlay without all that hassle of setup every time
So on the Pi idea, googling something like "raspberry pi camera video overlay" returns a bunch of hits, including https://hackaday.io/project/12450/logs
@past token It's true: C is a "low level" language, basically just a gloss on assember (which is, in turn, just a gloss on machine code). On the one hand, it's fast and enables you to do pretty much anything you want with the computer, on the other hand it's dangerous and tedious, as you have to deal with all the details explicitly. As for how not to feel lost, I would suggest starting small and building on that, don't try to build a big complicated system your first time out, just start with things like blinking LEDs and sending strings. Using libraries is great when they're available, they let you talk to a bunch of sensors without having to address all the details yourself. Using interrupts is more subtle and complex, and might take some real effort before you're comfortable with it.
@north stream Thanks for your reply! I have been trying to communicate with my GY-521 sensor without the usage of any libraries. It was a tedious and frustrating experience, as I never really had experience working that low of a level before. I resorted to just using libraries, but I will still take a look at the source code and pick at it one by one to see how it works.
Also, I thought this video was pretty cool:
Anyone know of existing examples of using multiple NeoTrellis boards with the NeoTrellisM4 in Arduino? There's a library in CircuitPython for it, but no obvious way to do the same in Arduino. https://forums.adafruit.com/viewtopic.php?f=59&t=146778
Tagging @fluid nebula
also @pine bramble
Trying to follow https://learn.adafruit.com/playing-arduboy-games-on-arcada/arduboy-test I get an error that ARCADA_MAX_VOLUME isn't defined
/Users/nick/Documents/Arduino/libraries/Arduboy2-master/src/Arduboy2Beep.cpp:50:19: error: 'ARCADA_MAX_VOLUME' was not declared in this scope
sine1.amplitude(ARCADA_MAX_VOLUME);
oh, the previous page playtune library link goes back to the same page, not to a zip archive. I assume it should be the result of downloading https://github.com/adafruit/ArduboyPlaytune
seems to be expecting it to be defined in Adafruit_Arcada.h, which I can't see that it was ever
https://github.com/adafruit/ArduboyPlaytune/blob/52ca6170af45432c07269861c91349e70b4cd73d/src/ArduboyPlaytune_Audio.cpp#L123 has the same issue
Hey, I downloaded this version of the IDE from the Software store in Kubuntu. Is it the most recent?
I'm assuming that its not...
I like to use snaps, and there is a snap for the 1.8.5 build of arduino, but not the newest. I wonder how easy it would be to snap the newest version...
@dusty meadow If you have sudo rights, you can always fetch the tar from the official Arduino site. It has a simple install.sh that will handle the install for you.
I can't get my 0.96 tft connected to my esp32 feather properly. Does anyone know a fix?
I even tried 2/3 wire spi
@surreal pawn you could try putting the following at the top of the sketch and see if it fixes it
#define ARCADA_MAX_VOLUME 1
@wraith current that doesn't work because it's not my code that has the error, is cpp files in the arduboy beep or play tune libraries I listed
If you put that define statement BEFORE you include any libraries, then it will replace any occurances of ARCADA_MAX_VOLUME with the value 1, even in other libraries.
a fix would be to add a line like that to Adafruit_Arcada.h or Arduboy2Beep.h for example
I tried adding it to the top of the INO, didn't fix it
@surreal pawn did you see this ? "These replace the existing libraries but add support for Arcada boards, for that reason, you should remove any existing libraries you have with these names!"
I didn't previously have any Arduboy libraries
The only arduboy libraries I have are from the adafruit github
sounds like it's a missing library somewhere
I doubt it
that file only includes the corresponding Arduboy2Beep.h which only includes Adafruit_Arcada.h
That's pretty crazy that there are ZERO google search results for ARCADA_MAX_VOLUME
Adafruit_Arcada.h is https://github.com/adafruit/Adafruit_Arcada/blob/master/Adafruit_Arcada.h
from what I can tell, no revision on that repository has had that symbol
so maybe its in one of the other 12 libraries required
I think ARCADA_MAX_VOLUME should be 255 because the Adafruit_Arcada implementation defaults volume to 255
you could always modify the library to statically use 255 in that function call.
but most likely it's just the first of many errors if something is really missing.
that's the only error I've run into. defining that symbol as 255 compiles and runs but I haven't checked if sounds are played correctly
hope that works, good luck.
So I got the 0.96 tft to work on the itsy bitsy M0 but I want it to work on the esp32 feather. I put CS in pin 14 and DC in pin 15.
mosi and sck are in their respective spots.
Hey, I need help with arduino, I have a arduino due
I'm new to arduino but I saw a really cool project where you can combine the arduino with node
it uses firmata
on the github repo they dont list the arduino due, is there still a way to use it for this project?
I also have a genuino 101
I don't see a listing for any particular Arduino at all at https://github.com/firmata/arduino , So I'd just give it a shot with either board and see if the basic examples work. If you've never done Arduino at all, you might want to start with the regular C++ code in the Arduino IDE, but maybe Firmata just works out of the box and would work better for you. No way for me to predict that ahead of time.
@pine bramble firmata just turns your due into a dumb peripheral. If I were you I'd just buy an uno to play with firmata, rather than trying to get the due working.
The due is a bit of a pain to get running with firmata. According to https://forum.arduino.cc/index.php?topic=606939.0 you need to:
- Connect the Due to your computer using the Programming port.
- Upload the StandardFirmata example sketch to your Due.
- Start the Firmata Test software.
- Select the Due's port from the Firmata Test software's Port menu.
- Press the reset button on the Due.
You can substitute your node app for the Firmata Test software.
Firmata in Arduino Due
I'm looking at the Arcada examples (for the PyGamer) and I understand how to use the GFX library to draw primitives directly to the screen. I also see how to create a framebuffer with some other means (like calculating the values in the mandelbrot example) and then "blit" it to the display. The thing I can't get my head around is this: Can I use the GFX library functions to "draw" to the framebuffer instead of drawing directly to the display? I'm sure there's a way to do this, I just can't figure it out!
Thx
I'm having some trouble with the st7735 library where I have rainbow static for the last couple of pixels around the edge on two sides
oh, actually, it looks like I have a few extra rows
nvm, one sec
after drawing some outlines, it seems like my problem is that the display area starts at 1, 2 instead of 0,0 and then I have static for those lines on the other side of the display opposite the origin
I'm using the adafruit ST7735 library
this is a banggood special though, so I wouldn't be surprised at all if it's the display that's wonky and not the library
anyone seen it before?
I was looking in wrong repo, I found my issue! https://github.com/adafruit/Adafruit-ST7735-Library/issues/66
easy fix 😁
Has anyone had success programming SAM devices over raspberry pi GPIO using OpenOCD?
I can get it to see the device ("Info : samd51j19a.cpu: hardware has 6 breakpoints, 4 watchpoints") but I can't get any code on the device successfully.
I've got it working in the past @patent marsh but my config file is lost to the ages unfortunately
make sure your openocd version is recent
if you're on a debian variant installing from apt I would expect it to be an out of date version that doesn't have samd51 support
It's able to run source [find target/atsame5x.cfg]
actually, now that I think about it, I might have had problems flashing over openocd too
But the program command gives me
Error: SAM: NVM programming error Error: Failed to erase block containing 00000000
I think I used bossac for flashing and openocd for debugging
yeah you gotta mess with the lockout bits and even then it doesn't work sometimes
was bossac easy enough to use?
yeah
I don't really care the tool so much as it being able to program on linux over raspberry pi gpio
even better you can do it over usb on any computer
the command I usually use is bossac -e -w -v -b -R -o 0x4000
plus the filename
erase write verify (I forget what the b is) reboot offset 16k
Okay, so I thought there wasn't a pre-flashed bootloader in the SAMs?
yeah I got my wires crossed, I thought we were talking about adafruit ones
Okay. Because, not at this very moment, but I'd love to be able to have an option for flashing SAMs and I'd meant to either do some experiments with OpenOCD or try out one of the flasher boards.
jlink works pretty well
In my case USB is not an option
The ambiguity of the jlink licensing bothers me because I'm far from a pro at electronics but I'd use it to manufacture lighting implements for art, which I have made money on.
Anyway.
I need to be able to flash over the cortex debug connector without an external programmer
I'm not sure but maybe Black Magic Probe works too @sturdy bobcat
never tried
@patent marsh what do you mean by "without an external programmer"? no hardware probe?
the black magic probe has pretty limited target support
i know for example the SAMD51 isnt supported
meaning all of adafruit's M4 boards
I think adafruit may have an arduino script for flashing over swd but I don't know much about it
@sturdy bobcat IMO that would qualify as commercial usage. i dont think they distinguish user experience or ability. but then again you could also argue you're usage is for hobby, and you use what youve learned personally for your professional endeavors
commercial usage is a pretty broad blanket -- if you -plan- to make money directly from the result of using their product, you are using it for commerce
i actually came here for a related question: i'm using my jlink debugger to figure out what's happening with some I2C comms, and its really bothering me how the current line in gdb keeps jumping around forward and back through the source code because of compiler optimizations. is there a way in arduino (1.8.9) to disable aggressive optimization altogether? i want to debug my program as close to source code as possible
this is on a grand central M4, btw, with its giant collection of compiler options in the arduino menu
arduino isn't really made for debugging
you might be able to hack in some compiler flags idk
but the least optimal compiler option is "small (-Os)"
yeah, where are the flags set? if i remove all -O flags, then it won't optimize (beyond whats necessary)
i'm used to just defining simple makefiles, i'm not real sure how arduino constructs its invocations to gcc
what do you mean arduino isnt made for debugging?
lots of arduino boards have JTAG/SWD pins dedicated specifically for debugging
it's more for beginners who don't have swd probes
anyway, I can't find the compiler options either
again, it's for beginners
thats awfully presumptuous, and overly generalized, but i know what you meaning
why are you using arduino instead of regular c++?
because i've had a headache trying to get a portable build system using anything other than arduino. i really only use it as a compiler, not as an editor (or debugger, if thats even possible)
what build toolchain do you use?
well, arduino uses gcc, that's not what i meant -- how do you invoke gcc/linker/assembler and flash your targets?
make
so you have to construct a unique makefile for every target and project? i would love to see your makefile template
I don't actually do that much embedded C
but I have a non-embedded makefile template
somewhere I think
well yeah, thats pretty trivial. that's what i use for my pc development too
yeah I mostly do rust on embedded
cargo build --target=thumbv7m-none-eabi has me covered most of the time
i wrote a perl script to generate my general purpose makefile for C development: https://github.com/ardnew/shell-utils/blob/master/Perl/mkproj
the actual template is near the bottom
this is my template
# the compiler: gcc for C program, define as g++ for C++
CC = g++
# compiler flags:
# -g adds debugging information to the executable file
# -Wall turns on most, but not all, compiler warnings
CFLAGS = -g -Wall \
$(foreach dir,$(LIBDIRS),-L$(dir)) \
$(foreach dir,$(INCLUDEDIRS),-I$(dir))
# the build target executable:
TARGET = L6Q1
# define the C++ source files
SRCS = L6Q1.cpp Point.cpp Tetromino.cpp
# define the C object files
OBJS = $(addprefix $(BUILDDIR)/,$(subst .cpp,.o,$(SRCS)))
# the libraries we are linking
LIBS =
# the directories where we have our header files
INCLUDEDIRS = $(CURDIR)
# the directories where we have our libraries
LIBDIRS =
# the directory where we will build
BUILDDIR = $(CURDIR)
# the directory where our source files reside
SOURCEDIR = $(CURDIR)
all: $(BUILDDIR)/$(TARGET)
# create object file from c++ file
$(BUILDDIR)/%.o: $(SOURCEDIR)/%.cpp
$(CC) $(CFLAGS) -c -o $@ $<
# link libraries and create final executable
$(BUILDDIR)/$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(BUILDDIR)/$(TARGET) $(LDFLAGS) $(LIBS)
# delete all the build artifacts
clean:
$(RM) $(BUILDDIR)/*
pretty simple, no perl required
was that a personal comment?
it's a quote from AvE iirc and I'm not going out with any girls at the moment XD
I'm not exactly sure what you mean by personal comment, but it was basically a jab at myself
@inland crag I mean a RPi connected via usb to something like an Atmel-Ice that is in turn connected to the microchip via 50mil, 10 pin, cortex debug cable a no-go. A Pi connected from the Raspberry Pi GPIO directly to the SWD connector is fine.
that's a tricky limitation
if you have an arduino this is probably your best option https://learn.adafruit.com/programming-an-m0-using-an-arduino/overview
yeah I understand that
The problem is getting openocd to do more than just erase the chip and set bootloader protection but
bit*
yeah I had troubles there as well
that's why I'm suggesting maybe this arduino flashing script might be a better option
openocd has issues
But I don’t understand why writing a bootloader seems so fundamentally different from just writing code that doesn’t need one directly to the flash.
because there is protection to prevent you from accidentally overwriting the bootloader and bricking your device
I'd try my luck with this if I was you https://github.com/adafruit/Adafruit_DAP/blob/master/examples/samx5_flash_from_header/samx5_flash_from_header.ino
Why on earth would overriding a bootloader brick a device? The whole point of debugger level access is that you can write the bootloader.
So if you overwrite the bootloader you can just write one again.
what is happening with the complex wiring scheme to make you say "a no-go" ?
and sorry if youve already mentioned, but if you have a configuration that works, why do you need the more complex one?
I have an application that will have peripherals hooked up to it. These peripherals have chips in them that will need to be software updatable remotely. I do not have the assurance that all chips will come from a particular manufacturer nor is there a pre existing list of all chips that there might be. Some chips may be using JTAG or SWD or SPI. I do have the assurance that I have hardware access to the programming pins. Embedding a debugger like a Segger J-link may work but it would also raise the cost hundreds of dollars per unit and I can only really afford to buy a couple J-links, not like 30. On the other hand, OpenOCD theoretically already does all this and can do it over a Raspberry Pi's GPIO. I have a proof of concept that is tantalizingly close to doing everything I need but figuring out exactly why I can't put code on SAMD chips is proving to be a pain.
Yah, my sympathies. I think the intention is to make it really hard to brick the device by overwriting the bootloader.
Can you write to other blocks of memory?
I don't even have a bootloader
and I can successfully overwrite the bootloader already
OOoh, I missed that.
And calling
atsame5 booloader 0
turns off bootloader protections anyway
That bit works
similar commands work for other chips
Hm. So, comparing what the OpenOCD code does versus the Adafruit DAP library, it looks like OpenOCD is trying to erase the chip block-by-block instead of doing a full chip erase.
Does a chip-erase command work?
I think so. I will check tomorrow.
It certainly stops all code from running but I can't remember if it runs error free.
Yeah, like, that seems to be a really obvious bug if they wrote a broken block-erase.
Hm, no, they do a block-by-block erase as well.
Okay, so this is weird.
Here's what I think is going on, looking at the code:
In https://github.com/adafruit/Adafruit_DAP/commit/6abd9f34452ce6e9f60410a349a87e8a23709c8f#diff-a6e9dfc1ddc0095cf270dbd446006411R152 it's unlocking the region, erasing the block, and then writing the block.
http://openocd.zylin.com/gitweb?p=openocd.git;a=blob;f=src/flash/nor/atsame5.c;h=eac7847dca807d911ade60e0f88a56250565e761;hb=HEAD#l419 it's just erasing and writing the block.
If I search the file for more unlock-block commands, they aren't there.
I'll have to take a look at this more in detail tomorrow. It could explain some things.
Yeah.
On the other hand I would think that it works on the E54, E53, E51, or the D51 or they wouldn't have committed the file in the first place
I wouldn't bet on it
Obviously not every command sequence would be tested on every target clearly
It wouldn't be the first time that I came upon some code where I was like "Wait, how did that ever work?"
but I would think you'd have some test hardware while writing some code
Well, they aren't protecting any memory blocks.
You can also do a protect-check and see if it is, in fact, protected.
If they had been goinking with the device and had managed to get it all unprotected, the code won't protect it if they don't deliberately set it to.
..and I don't see an unprotect command.
This makes me want to get a SAMD51 of my own.
So, if I'm right, the patch looks something like this:
/* Issue the Unprotect Block command. */
if (res == ERROR_OK)
res = same5_issue_nvmctrl_command(target, SAME5_NVM_CMD_UR);
guys
having hard time running a stepper motor and displaying a scrolling text smoothly at the same time
is it possible to do it on a huzzah esp8266 or "it is too weak"?
stepper motor needs to loop 4000 times with a delay of less than 1ms to run smoothly
What are you displaying your text to? the serial console? it takes a long time to write to the console. At 9600 baud it takes ~1ms per character!
Even more if you account for stop signal aswel!
Okay so I got it working sort of
The trick was to first write the image to the flash using atmel studio and a traditional programmer
then I connect to the target and the dump_image. I guessed at the size argument and just picked a number I thought would be larger than program and variable space.
then I can use flash write_image to write back the bits openocd found
Finally I run verify_image dumped.bin to check that all the bits made it there
this gives an error at first, error executing cortex_m crc algorithm but will continue on anyway after a little bit and say either something like verified 16777215 bytes in 54.900013s (298.433 KiB/s) or give a long list of sectors that don't match
if it says verified, you only have to power cycle the device and then the code from the recorded binary will begin to run.
curiously, reset run is not enough and you need a power cycle.
It's a clunky workflow and 55s is a long time to wait on programming but it does make remote code deployment without a debugger possible
I really think it's a big with the protection bits not being frobned in OpenOCD.
Because any dev testing probably used a board that's been programmed a few times using the took
but flashing images works
I think it's just not handling variable space or other configurations the way atmel studio does
but if you read the entire memory space and write it back the same way, of course it will be the same.
which is what I'm doing
To find out what atmel studio does via their programmer I would probably need to hook up a logic analyzer and actually decode the swd commands. I can do that but it's also a bit lower level / more into weeds than I wanted to go.
I have a Saleae Logic 8 so it's not a hardware problem but I'm not very familiar with SWD so I wouldn't know exactly what to look for and I expect the bit stream to be a lot to unpack.
Note you do have to issue atsame5 bootloader 0 or programming will fail
Logic Pro has the protocol decoder I just don't know what actual words I'd be looking for
I have ATtiny85 programmed as variable PWM generator with analogRead and analogWrite. But when measuring with my meter it tells me the frequency is only about 500Hz, but I need like 50kHz for my project. Is it possible to speed it up? Or should I stick with descrete logic?
I was able to get around 40kHz with descrete logic generator, but as you can probably imagine it's a lot more complex.
You can change the PWM frequency, but I don't know if it will go that high on that CPU.
Why do you need 50kHz PWM? Analogue filtering?
Boost converter
Ah, that makes sense. I haven't tried using a CPU to control a boost converter, but I know it's possible (other people have done it), and I can understand the appeal of not having an additional chip.
the default PWM is tuned for servos, which want 490Hz IIRC. I know an M0 can do a lot faster, but the attiny85 might be able to do better
it seems the attiny85 can reach max of CLK_IO/256 for its PWM frequency. I believe clk_io can be the same as the core clock, so e.g. if you're running it at 8MHz, the max PWM frequency would be 8MHz/256 = 31.25 kHz. with this logic, to reach 500 kHz you'd need to run your attiny85 at 1.28 GHz 😄
From the attiny85 datasheet:
" Table 12-3 on page 88 lists clock selection and
OCR1C values to obtain PWM frequencies from 20 kHz to 250 kHz in 10 kHz steps and from 250 kHz to 500 kHz
in 50 kHz steps. Higher PWM frequencies can be obtained at the expense of resolution"
So it sounds like it's capable of doing what you want, just not with the default ardiuno TC config
50 kHz PCK/8 0100 159 7.3```
Ok, thanks for the info. Also: it's possible gor me to run ATtiny85 with external 16MHz crystal because I'm not using crystal pins.
ahh, thanks for the correction, lumin! I totally missed that 😅
So now I have a different problem: I hooked up the discrete logic generator, but I'm not able to get more that 15V on the output. And since I don't have a scope I can't verify what the generated signal looks like. I'm using 100uH coil, 1000uF capacitor, 1N5822 diode and IRF840 transistor.
This is a flyback type power supply? What's the input voltage to the coil? What's the coil resistance? What's the coil's saturation current?
Easiest change is to try a smaller capacitor, ideally a film or ceramic one.
Also, what's the ATtiny power supply? It takes several volts to turn on an IRF840 fully, and you may also be having issues with stored charge. Flyback power supplies have some fairly intricate requirements.
Supply voltage is 5V to both generator and the coil. Coil resistance is 0.24 ohms. I don't have the coil's datasheet, so I don't know the saturation current. I don't know how to measure it either, but if you tell me how I might be able to tell.
Easiest check for saturation is if the coil or transistor are getting warm.
However, the transistor will also get warm if it's not getting switched quickly (enough gate drive current) and solidly (enough gate drive voltage).
Neither the coil or the transistor were getting warm, even at 90% duty cycle.
It's a regular boost circuit, not flyback converter
I had thought all boost circuits were transformers, voltage multipliers, or flyback inductors, but perhaps I missed something?
Something like this
https://upload.wikimedia.org/wikipedia/commons/4/4a/Boost_circuit_2.png
Maybe this also is a flyback converter and I'm just dumb
Not dumb, we all start as beginners. Yeah, that's a basic flyback boost converter (it turns out there are only so many ways to get out more volts than you start with).
Good to know, hopefully I'll never make such mistake agin.
It looks like a really simple circuit, just 3 parts, but these boost converters turn out to be subtle and complex in operation.
I built 555 PWM generator and it was able to get to 55V. Transistor got a little warm. It's still not enough though.
How much voltage are you hoping for? The 555 circuits tend to work fairly well, once you've ironed out the basics.
I wanted to make a power supply for nixie tubes, so something around 180V
Heh, that was my guess. I'm a member of a nixie building mailing list, and we discuss power supplies on a frequent basis. 😃
Here's one good reference by another list member https://desmith.net/NMdS/Electronics/NixiePSU.html
Let me see if I can dig up the 555 one that's pretty solid (there are several 555 designs floating around that don't work well)
My approach was to get a high voltage mosfet, pwm generator and hope it reaches high enough voltage, but seems like that's not enough.
Yeah, exactly
I just don't know what sets the voltage limit
Maybe I should use a mosfet gate driver?
I'm a big fan of gate drivers, especially for higher speed stuff like this.
Could be. You need a fast, high voltage diode.
Well, my diode is fast but not exactly high voltage
For a lot of my projects, I like to use John Taylor's ready-built modules. They're small, efficient, robust, and reliable. https://www.shop-tes.com/power-supply/
They look really nice, but I was rather looking to build one myself. I know it's just making things harder though
Oh, I totally get that, I've rolled my own as well. It's a great learning experience, but it can be really frustrating. As Nick says on the page I linked above, "for a configuration like this, where the step-up is large, what becomes absolutely critical is component choice and board layout."
I had much better luck starting with 12V than 5V.
I wanted it to be supplied from 5V because all logic runs on 5V and this would eliminate the need for additional regulator. But starting with 12V is probably the right thing to do.
Tomorrow I'm getting a different diode, that should hopefully help with achieving higher output voltage.
As for the board layout, the fact that it's built on a breadboard probably doesn't help either. I tried to keep everything as close together as possible.
It's possible to build high boost supplies on breadboards, but it's harder.
I wanted to stick with breadboard until I get a satisfying voltage out of it
Yeah, debugging is easier/faster with a breadboard, it's just tricky with high voltage/high current/high frequency stuff. Since I'm guessing you're not using feedback, it should be somewhat easier. Sometimes running the high current loop (power supply, inductor, transistor, and back to the supply) separately with short heavy wire can do the trick.
I'll keep that in mind, thanks
Hello.
I am using Adafruit-Fingerprint-Sensor-Library on R307 with ESP32 Arduino.
R307 can save 1000 fingerprint data.
But this library supports (#1-127=)127 data.
How to use 1000 data?
Looks like the slot is a uint8_t which might support up to 255, but presumably to support more, the variable type would have to be changed. It looks like the SEND_CMD_PACKET() method might adjust to that, but you'd have to check the documentation for the sensor to see if it uses a different format/procedure for addressing quantities that don't fit in a byte.
It depends on how far you care to dig into it.
umm...I give up...
I wait for someone to make it.
maybe it is impossible for me.
@pine bramble Perhaps you can file an issue here:
https://github.com/adafruit/Adafruit-Fingerprint-Sensor-Library/issues
@silk scaffold @lethal wigeon Is there a BSP for the Circuit Playground Bluefruit - ALPHA? Can't wait to take it for a spin! Happy to test.
@north kelp thx you.
But I decided to put up with 255 data...
HELP which board do I use for the new CPX BFE?
I've tried Bluefruit Feather nrf52840 Express and CPE. I'm on Win 10 Arduino 1.8.21.0
OK Hold on
Serial Monitor shows temperature and responds to button pushes using the Feather.
So, even though Win 10 just beeps and shows no evidence of the board, it's there
Sweet, Light sensor, temperature, x,y, and z slide position. SWEET!
Now if I can just remember how to code in Arduino. 🙂
Huh? CPLAYBTBOOT just showed up in my Windows Manager
That's a good thing. Right?
Tried to upload, buncha red text about bootloader not the same. So,..
Thanks. I was just about to go that route after reading the text file on the CPX. DUmmy me.
Time to knock off for tonight. I can't get that board in the Board Manager. Thanks for the help though @inland crag
yw, I think you can copy the entire nrf52_arduino from github into some magic arduino folder
then it should work
Humm, I thought of something like that. I'm just not that familiar with drilling around in the github. I thought adding the url would be all it took but all I got was a Nordic nRF52840DK (PCA 10056). All I can get is port busy or not found depending upon if I'm in bootloader or not
it probably hasn't been released yet or something
Well thanks for your time @inland crag , my brain cell is fried so I'm gonna go Watch Big Brother...
@rotund dust next time you're feeling up for it you should be able to download the github as a zip and extract it here C:\Users\<username>\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.12.0
no git skills necessary
can't wait to give QT a try
@tidal turret there is the Adafruit neopixel über guide in the Adafruit learn section on their site for reference. What board are you using and what kind of setup do you have - power and number of pixels? What problems are you having with the neopixels?
How much current can i deliver to ir diode? For white diode it is about 20mA, but how about ir?
And another question, how much voltage can generate ir receiever? And what resistor i must ude to connect it?
@bleak glacier man i know that allredy, my problem is too slow arduino reaction
i need to turn off 150 leds like 1 2 3 4 5 6 7 8 9 and turn off 1 turn on 10 turn off 2 turn on 3
Good morning @inland crag , thank you for the Github lesson. I'm getting started on it as we speak it is extracting. Thanks again. New day, blond brain cell is fresh, hoping things go better. 🙂
YAY!!! Serial monitor on a CPX BFE at 9600 baud com 10 out of the box!!!!!!!!
aaannndddd we're.......BLINKING!
Commence happy dance.
OK. Now the real work starts. Do something with two of these.
Last night I was feeling like I ripped off a real developer by snagging these two.
Thank you @inland crag for help and encouragement.
@tidal turret how much slower is it than you need?
@bleak glacier Do you know - are there problems driving NeoPixels from Arduino because of 3.3v vs. 5v?
I.e., NeoPixels seem to expect 5v for both power as well as the digital signal. And Arduino boards all seem to maybe produce a 5v power supply, but never 5v digital pin output
@sly oak They can run on 3.3v despite what the datasheet says.
CPX schematic:
https://learn.adafruit.com/assets/49671
Ref. D1 and D4.
D1: D8_NEOPIX on package pin 38 (PB23) of ATSAMD21G18. That's a 3.3 v GPIO pin.
D4: D8_NEOPIX - data input to the NeoPixel array on the Circuit Playground Express.
Note that it's 3.3v all around.
Cell C4 of this Crickit CPX schematic (drawing 3/3) shows how to correctly drive a NeoPixel from a 3.3 v GPIO pin, using a 5v supply for the NeoPixel:
https://learn.adafruit.com/assets/53977
74AHCT125 driver ('level shifter'):
https://www.adafruit.com/product/1787
Almost all of the time, you can get away without the 74AHCT125 line driver, and just use 3.3v throughout. The NeoPixels are fairly reliable when used in this way.
It's quite possible the manufacturer knows of the issue and just goes ahead and makes them (barely) operable at 3.3v - they're fine that way, in practice.
The only thing you must not do is mix voltages (do not use 5V NeoPixel supply with a 3.3 v GPIO pin!)
I have just received my Adafruit Gemma M0 and want to use SoftwareSerial.h however it says no such file or directory. When i compile for my Flora it works, any idea why this library cannot be used with the M0?
I think you just Serial1.begin(9600);
its for a SRF01 and in the documentation it uses: SoftwareSerial srf01 = SoftwareSerial(SRF_TXRX, SRF_TXRX);
Do you have a link?
wiki:The SRF01 Ultrasonic Range Finder uses Devantech's 2nd generation AutoTune technology that allows ranging from 6 meters (19.7') all the way down to zero on a single transducer sonar module.
correct, can the M0 only run 2 pin? looks like RX TX runs separate?
I think I did a demo once, or at least read up on it enough that I was 'about to'. ;) Pretty sure it can be done.
ok i really hope so, my flora died so i bought the Gemma hoping i could make prototype a bit smaller 😄
The thing is, there's very few pins brought out on Gemma. You may need to prototype on a 'full' M0 board with lots of pins, solve the existing problems, then see if it will go on Gemma (may not).
yeah so all i need is 1 vibration motor and 1 SRF01, i have everything working on the flora that decided to suicide and didnt research enough on the M0, just saw serial was available and got super excited. its a simple sensor for my friend who is blind.
I used half duplex USART SAMD21 in Google as my search terms.
The more I remember, the more I think that the first link I gave is where I was going with this.
I don't remember who was working on this (or when). I think we got pretty close, though.
This is ticking all the right boxes for me:
https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/creating-a-new-serial
thanks so much, ill have a read. its looking quite complex i may have to go back to the flora 😛
thanks @pine bramble!
Has anyone effectively used python on arduino? or is it a rarity?
@waxen flare Which arduino? Circuitpython is a thing, but not for every Arduino. 8-bit microcontrollers are not particularly conducive to more complex interpreted languages.
there is snek though
I am using the arduino uno right now.
I have a project in mind, and I'm on the fence if I should just by circuit python or not.
My power went out. Thanks for your patiencs
patience
@waxen flare if the libraries you need are available and robust in circuit python then use it if you like it better than Arduino
CIrcuitPython cannot run on an Arduino Uno. Not sure if that is what you were asking.
Hi everyone! I'm having issues with the gemma v2 and arduino. I go to upload the blink sketch as detailed in the guide on Adafruit https://learn.adafruit.com/introducing-gemma/setting-up-with-arduino-ide, and I get the error avrdude: usbdev_open(): did not find any USB device "usb" (0x03eb:0x2104). I have already blown
away the IDE and installed a fresh copy with the adafruit AVR boards and Arduino AVR boards. I have checked my hardware cables and just can't figure out what is going wrong.
Just swapped over to usbtinyisp and checked that programmer, still getting an error about not being able to find a board. Is it probably a hardware issue or is there something wrong with my libraries?
Windows? Did you install the driver?
Mac OSX.
Now it's throwing "the selected serial port
does not exist or your board is not connected". I'm gonna try another usb, hopefully that fixes things.
Alright I've attempted with 8 different usb cables and I've googled around for a bit. Still can't figure it out. Latest arduino with Adafruit AVR libraries. I'm just wondering if maybe I have a bad board?
What editor are you using?
Your issue sounds like one I had when I was using an outdated version of Mu.
Alright figured out the issue. Red light wasn't flashing, totally sorry haha! Thank you all for the help!
Does the LED pulse when you plug it into your Mac?
That indicates the bootloader is active and ready for upload. But if you wait too long, it will time out.
Yeah that was my issue. I saw the LED come on and then turn off, I didn't realize you had to hold to get the bootloader to kick in
Oh good, @vernal knot !
Here's more info on the bootloader and timing of uploads, including a helpful video:
https://learn.adafruit.com/introducing-gemma/about-the-bootloader
Awesome. Thank you all so much!
I'd like to point out that the newer GEMMA M0 is much less problematic to program, has a ton more memory and speed, and is the same price:
The Adafruit Gemma M0 is a super small microcontroller board, with just enough built-in to create many simple projects. It may look small and cute: round, about the size of a quarter, with ...
I did see that, and I've used M0 before. I am working with parts purchased through my university and so I'm glad I figured it out. I will definetley be using the M0 in the future!
Hello, I'm Arduino beginner.
It is first touch to C++
I can't understand how to send data (ex. string = hello world) via BLE. (Client[Central] = ESP32, Server[Peripheral] = Another ESP32)
Paring is success.
🤔 maybe if You are a beginner try doing something simple first to get familliar with C++. Also look for some example sketches on the internet because they might help you.
I disagree, you barely need good knowledge of c++ to program Arduino.
For beginners it is usually easier take examples and adept them to your own need
Bluetooth can be a bit problematic to work with
Maybe don't use string but instead use char* var = 'hello world'
Thank you.
I'm so studying now.
I try to search again.
Yeah, it's true, you don't need much knownledge, but when I do something I always start with the simplest things.
I thought arduino was C, not c++
It is actually a subset of c and c++ @cerulean stratus
Gotcha
Hi
i'm having some trouble with my code
and was wondering if anyone could help
i'm working with a dht11
and in my code
there is an error that says
dht does not have a name type
can anyone help
Sounds like a reference to a library class method that doesn't exist?
Arduino: 1.8.9 (Mac OS X), Board: "Arduino/Genuino Uno"
sketch_aug28f:9:1: error: 'dht' does not name a type
dht DHT;
^
/Users/visal/Documents/Arduino/sketch_aug28f/sketch_aug28f.ino: In function 'void loop()':
sketch_aug28f:48:6: error: expected unqualified-id before '.' token
DHT.read11(dht_dpin); // Reading data from DHT11
^
sketch_aug28f:52:20: error: expected primary-expression before '.' token
Serial.print(DHT.humidity);
^
sketch_aug28f:55:20: error: expected primary-expression before '.' token
Serial.print(DHT.temperature);
^
sketch_aug28f:61:9: error: expected primary-expression before '.' token
if((DHT.temperature < 26) && (DHT.temperature >= 23.2)) // Writing the LED colour pins HIGH or LOW to set colours
^
sketch_aug28f:61:35: error: expected primary-expression before '.' token
if((DHT.temperature < 26) && (DHT.temperature >= 23.2)) // Writing the LED colour pins HIGH or LOW to set colours
^
sketch_aug28f:71:10: error: expected primary-expression before '.' token
if((DHT.temperature < 23) && (DHT.temperature > 20.2))
^
sketch_aug28f:71:36: error: expected primary-expression before '.' token
if((DHT.temperature < 23) && (DHT.temperature > 20.2))
^
sketch_aug28f:82:9: error: expected primary-expression before '.' token
if((DHT.temperature < 20) && (DHT.temperature > 17.2))
^
sketch_aug28f:82:35: error: expected primary-expression before '.' token
if((DHT.temperature < 20) && (DHT.temperature > 17.2))
^
sketch_aug28f:94:9: error: expected primary-expression before '.' token
if(DHT.temperature <= 17)
^
Multiple libraries were found for "DHT.h"
Used: /Users/visal/Documents/Arduino/libraries/DHT_sensor_library-1.3.7
Not used: /Users/visal/Documents/Arduino/libraries/DHT-sensor-library-master
exit status 1
'dht' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Ah, that's different from not having a name type.
im sorry
Looks like a missing instance declaration
It's trying to use dht as a class name, and it isn't defined. I'm guessing either a missing include statement or you need to use a different type name.
Where did you find the code you're using?
i got this from a website