Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Ethics_Gradient
May 5, 2015

Common misconception that; that fun is relaxing. If it is, you're not doing it right.

babyeatingpsychopath posted:

Let's see the soldering job. Since it's I2C, there's a chance your soldering may have bridged/broken the I2C address pins so your code isn't trying to talk to the right device. The brief flicker at power-on may or may not be good. The I2C LED stuff I have doesn't do ANYTHING until it sees valid I2C instructions on the bus, so the flickering may indicate that something's cross-wired.

Can you still talk to the Nano via the serial port monitor while your code is running?

'Twas the soldering after all! Had to wait until my partner was back at work to check; I wear a respirator when I work, but she's still not a fan of me soldering in the house.

I've also soldered some jumper wires to the female 1/4" jack which connects to my foot pedal; tested it by putting it between the Arduino 5V pin and the power rail on the breadboard and it's working :woop: Feeling proud of myself on the latter; didn't come with any documentation so had to figure out the pins using my multimeter.

Now to have a play around and see how to actually output to the display.

edit: this is a lot harder than expected :negative:

Has anyone got a recommendation for a YouTube series on learning Arduino? What I'm after being able to do is:
  • Use two different momentary buttons to set up fixed countdowns of different lengths (15s and 180s)
  • Use a third momentary switch (foot pedal) to start the countdown. A second press pauses it, a third resets it.
  • Output the countdown via I2C to the Adafruit backpack/4 digit 7 segment display
  • 15s countdown: Have a speaker make a "tick" every second. At 0, plays a brief tone then resumes ticking until paused/reset reset by the foot pedal.
  • 180s countdown: no ticking, just a tone at 0, possibly light up an LED. Reset in the same manner as above.

None of this seems like it should be too hard, but my hamfisted attempts to jam code together from different sketches isn't working out too well!

Ethics_Gradient fucked around with this message at 06:48 on Apr 20, 2022

Adbot
ADBOT LOVES YOU

Ethics_Gradient
May 5, 2015

Common misconception that; that fun is relaxing. If it is, you're not doing it right.
Update:

I found Paul McWhorter's series which is really great; very thorough and well-explained, with some "pause and try to do this yourself now" tasks that build on what he's been teaching. Episode 2 contains a 30 minute deep dive into the physics of LED's and semiconductors which I admittedly skipped most of, but nice to see the detail is there if I want it. Been using the TinkerCAD emulator for now.

Question: from adafruit's tutorial for my 7 segment display + backpack, it says the backpack has two additional commands:

quote:

There are also a few small routines that are special to the backpack:

setBrightness(brighness)- will let you change the overall brightness of the entire display. 0 is least bright, 15 is brightest and is what is initialized by the display when you start
blinkRate(rate) - You can blink the entire display. 0 is no blinking. 1, 2 or 3 is for display blinking.

Probably missing something obvious here, but how do I add them? I'd assumed they were in one of those libraries mentioned in the code (don't want to quote it all again, it's in my earlier post though), but when I try to put them into the sketch and compile it says they're undeclared.

DC to Daylight
Feb 13, 2012

Ethics_Gradient posted:

...but when I try to put them into the sketch and compile it says they're undeclared.

Can you post your code?

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


Ethics_Gradient posted:

Update:

I found Paul McWhorter's series which is really great; very thorough and well-explained, with some "pause and try to do this yourself now" tasks that build on what he's been teaching. Episode 2 contains a 30 minute deep dive into the physics of LED's and semiconductors which I admittedly skipped most of, but nice to see the detail is there if I want it. Been using the TinkerCAD emulator for now.

Question: from adafruit's tutorial for my 7 segment display + backpack, it says the backpack has two additional commands:

Probably missing something obvious here, but how do I add them? I'd assumed they were in one of those libraries mentioned in the code (don't want to quote it all again, it's in my earlier post though), but when I try to put them into the sketch and compile it says they're undeclared.

I assume you're calling matrix.setBrightness() and matrix.blinkRate(), since your device is defined as
Adafruit_7segment matrix = Adafruit_7segment();

Ethics_Gradient
May 5, 2015

Common misconception that; that fun is relaxing. If it is, you're not doing it right.

DC to Daylight posted:

Can you post your code?

I didn't want to spam the thread, it's on the last page.


babyeatingpsychopath posted:

I assume you're calling matrix.setBrightness() and matrix.blinkRate(), since your device is defined as
Adafruit_7segment matrix = Adafruit_7segment();

Nope! Didn't realise I needed the "matrix." in front. Working now :cool:

DC to Daylight
Feb 13, 2012

Ethics_Gradient posted:

I didn't want to spam the thread, it's on the last page.

D'oh - Should have noticed that.

To add a little to BEP's comment, let's look what your setup code did.

Adafruit_7segment matrix = Adafruit_7segment();

The Adafruit_7segment is the object type. Matrix is the name for the object you created. And the function is a handler to set up the object. So "matrix" isn't some magic word, it's just the name that Adafruit chose for the 7-segment object in their code.

Compare this with, for example,

int MyInt = random();

Same concept - what kind for variable (integer in this case), an arbitrary name, then a function that assign a value to it.

I'll also add that although I've never used that display, the dimming function on every one I've tried is barely functional. Like 15-20% change in brightness from min to max.

cruft
Oct 25, 2007

I need to be grumpy about something for just a second here.

This person is making their code available for download, as a word processor document. I just don't even understand how someone could get to a place where they would do such a thing.

Thanks for coming to my TED talk.

Hadlock
Nov 9, 2004

I found out I work with a guy who is really proud of using notepad++ in TYOOL 2022 and I'm pretty sure he's under 40

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Hadlock posted:

I found out I work with a guy who is really proud of using notepad++ in TYOOL 2022 and I'm pretty sure he's under 40

A decent number of junior python CS majors ive interviewed are proud of using vim or text editors to write their code rather than a proper ide with some default linting

I review their code

its very poorly formatted

Cojawfee
May 31, 2006
I think the US is dumb for not using Celsius
I don't understand why people are proud to make things harder for themselves. No one gives a poo poo if you've memorized the functions of an API and you can just type it without autocomplete. You still have an off by one error.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
(Bad) job interviewers love to use that as a gotcha though

Wibla
Feb 16, 2011

Hadlock posted:

I found out I work with a guy who is really proud of using notepad++ in TYOOL 2022 and I'm pretty sure he's under 40

It sure beats normal notepad for editing text files? :v: I use it a lot. But not for coding, obviously.

CarForumPoster
Jun 26, 2013

⚡POWER⚡

Wibla posted:

It sure beats normal notepad for editing text files? :v: I use it a lot. But not for coding, obviously.

Oh yea NPP is great IMO. I use it several times per day

cruft
Oct 25, 2007

I mean I write stuff in vi sometimes. you just need to be mindful of your formatting. But I've also been doing this since vi was the only option.

The main thing is, don't use Microsoft Word.

Hadlock
Nov 9, 2004

CarForumPoster posted:

A decent number of junior python CS majors ive interviewed are proud of using vim or text editors to write their code rather than a proper ide with some default linting

I review their code

its very poorly formatted

We had a "senior" guy on our team he was very proud of writing all his code (mostly go, bash, yaml, json) in vim

I would load up his code in my ide and the whole thing would be full of red and yellow squiggles under the text, just pages and pages of it

One day in a very passively agressive moment of rage I ran all his code (like 9 repos) through gofmt and various linters and finally fixed his poo poo with a bunch of PRs :f5:

CarForumPoster
Jun 26, 2013

⚡POWER⚡

cruft posted:

I mean I write stuff in vi sometimes. you just need to be mindful of your formatting. But I've also been doing this since vi was the only option.

The main thing is, don't use Microsoft Word.

Unless you're doing this cause you had to SSH into something, I bet your code has mad squiggles bro

cruft
Oct 25, 2007

CarForumPoster posted:

Unless you're doing this cause you had to SSH into something, I bet your code has mad squiggles bro

Mmkay.

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

vim can autoformat and autocomplete. it’s not 1996 any more.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

gui vim even has squiggles

cruft
Oct 25, 2007

Okay help me out here. I'm using a Seeeduino Xiao (SAMD21 Cortex M0) with Adafruit's FreeTouch library. It works great, as long as I'm only touching one pad. If I touch one pad, then a second one, it sees me releasing the first.

If I have Cruft Jr touch one pad, and then I touch a second one, it thinks both pads are touched.

I figure this is some analog electronics thing that my computer science brain is going to have a lot of trouble understanding. Like, maybe I need to specify some of the additional arguments to the Adafruit_FreeTouch constructor, instead of just the pin?

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


cruft posted:

Okay help me out here. I'm using a Seeeduino Xiao (SAMD21 Cortex M0) with Adafruit's FreeTouch library. It works great, as long as I'm only touching one pad. If I touch one pad, then a second one, it sees me releasing the first.

If I have Cruft Jr touch one pad, and then I touch a second one, it thinks both pads are touched.

I figure this is some analog electronics thing that my computer science brain is going to have a lot of trouble understanding. Like, maybe I need to specify some of the additional arguments to the Adafruit_FreeTouch constructor, instead of just the pin?

Their example sketch specifies additional arguments to the constructor, so probably?

Everything is based on capacitance, and Cruft Jr has less skin surface area, so has a different capacitance; it checks out.

cruft
Oct 25, 2007

babyeatingpsychopath posted:

Their example sketch specifies additional arguments to the constructor, so probably?

Everything is based on capacitance, and Cruft Jr has less skin surface area, so has a different capacitance; it checks out.

Well, at least somebody else is saying "who knows, gently caress around with the arguments until it works".

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


cruft posted:

Well, at least somebody else is saying "who knows, gently caress around with the arguments until it works".

Mostly because I can't see your code and don't know specifically what specific things you're using for "sensors."

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
I'm at my wits end on this. I've been programming Arduino stuff for years, and this is baffling.

To put it briefly, the project is to have an (3.3v) Arduino interpret a sensor input for a Brightsign (digital video player, uses 3.3V GPIO). Final program will use a Teensy, but right now I'm messing with an Adafruit Metro M0 because it is on my desk. Basically, if the Arduino reads the sensor trigger, it does a lighting effect on some neopixels, and puts an output LOW. This triggers a video to be played on the Brightsign. It then waits for the Brightsign to run a pin HIGH when done. When it sees the high signal back, it stops the lighting effect, and goes back to reading the sensor, waiting for the trigger.

I've had no trouble with the output signal at all. It's the input back that's driving me nuts.
I did some checking, and realized the Brightsign is most likely pushing it's Output HIGH when active, but when inactive, is floating, not being pulled low. (Hardware docs: https://brightsign.atlassian.net/wiki/spaces/DOC/pages/378832362/HDx24+Hardware+Interfaces#HDx24HardwareInterfaces-GPIO)

So, I thought, oh, simple, I just need to use a pulldown resistor. No dice.

I've gotten to the point where I've completely started over from scratch, and I've written a program that sends me serial messages at each step.
I was still having trouble.
Even with NOTHING connected to the pin, or changing it to a pullup and reversing the logic, I'm getting some stupid-rear end results.

I've stripped it down to just this:
code:
setup()
{
pinMode(FROM_BS, INPUT_PULLUP)
}

loop()
{
	reading = digitalRead(FROM_BS);
	Serial.println(reading);
	if (reading == LOW)
	{
		Serial.println("BS Feedback");
	}
}
and I'm getting this in my serial terminal:

goddamned stupid console posted:

1
BS Feedback

The 1 should mean it just can't loving even post the serial comment!!

I've tried changing pins, doing pullups, pulldowns, etc. I've pulled a fresh Metro Express right out of the box and I'm getting the same problem. I don't even have anything connected to the pins when doing a pullup, and this happens. Am I missing some dumb obvious thing?

edit: typo in code that was also present in program. didn't fix it though.

Fanged Lawn Wormy fucked around with this message at 22:41 on May 26, 2022

cruft
Oct 25, 2007

Fanged Lawn Wormy posted:

Am I missing some dumb obvious thing?

You have a single pin going out and you want to know if it's being driven, right? Is the display using the same voltage source as the arduino? If not, you don't have a circuit on that output pin.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
yep, grounds are tied together.
But I'm even at a point where I'm just sitting with no external hardware, and a wire to jump ground to the input pin on the MCU, using the internal pullup resistors, and triggers when the input isn't being touched to ground at all.

cruft
Oct 25, 2007

Fanged Lawn Wormy posted:

yep, grounds are tied together.
But I'm even at a point where I'm just sitting with no external hardware, and a wire to jump ground to the input pin on the MCU, using the internal pullup resistors, and triggers when the input isn't being touched to ground at all.

I'm guessing the issue here is that you're using a circuit designed to probe a switch, and trying to probe something that generates voltage. I don't know enough about electronics to explain why this is happening, but my guess is you're "backfeeding" whatever on the display provides the voltage out. You may even be charging a capacitor.

You probably need a transistor somewhere.

Somebody else who's not an idiot about such things should chime in now :)


e: Wait, wait, wait. You have nothing at all connected to the Metro, and a pin configured as a pullup, and it reads low occasionally? Like, the display isn't even in the same room? What is FROM_BS? How is reading defined? Can you paste the entire program?

cruft fucked around with this message at 23:01 on May 26, 2022

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
Ok, I AM a moron. It was the typo I edited out, but my brain was so fuzzy I didn't click with me that it did change.

this was the typo:

if (reading == LOW); <<<<<<<<<THAT SEMICOLON

of course, I didn't realize right away, I just observed that the TX led was blinking and glanced at the serial window and saw output and cussed.

But of course it was supposed to be sending messages. It sends the pin status no matter what. it adds the extra text line if it sees the correct result.

I need sleep.

cruft
Oct 25, 2007

Fanged Lawn Wormy posted:

if (reading == LOW); <<<<<<<<<THAT SEMICOLON

I am laughing at you right now. Definitely not laughing in sympathy because I can relate, having done this exact thing dozens of times myself. 100% a "ha ha you fool" kind of laugh.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
at least it wasn't using = instead of ==. there was a few months where I just couldn't stop making that mistake. Visual studio often flags that now though, so that helps.

Or, another one I've been doing:
if(digitalRead(PIN == LOW)) - that also fucks some poo poo up

petit choux
Feb 24, 2016

Dear thread, I hope you can forgive me for barging in like this, it's a typical scenario I'm sure. I don't really know what I'm doing and don't know where to turn. I'm hoping somebody here can advise.

http://brendanclarke.com/2014/04/23/arduino-based-midi-sequencer

Kit soldered together, files downloaded, Arduino installer installed on my Thinkpad. The MIDI folder he included in his zip file, I can't get it to do anything, can't make the installer recognize it. So I went to the github page he also linked, DL it, get the installer to add it. Then I open the .ino file, try to compile, get a compile error many times saying it's calling to a library called MIDI that doesn't exist, it suggests I try MISO? Man this is frustrating. I imagine I've spent the better part of a day on this all together. I'm really frustrated. Have I angered the Gods?

DC to Daylight
Feb 13, 2012

petit choux posted:

Dear thread, I hope you can forgive me for barging in like this, it's a typical scenario I'm sure. I don't really know what I'm doing and don't know where to turn. I'm hoping somebody here can advise.

http://brendanclarke.com/2014/04/23/arduino-based-midi-sequencer

Kit soldered together, files downloaded, Arduino installer installed on my Thinkpad. The MIDI folder he included in his zip file, I can't get it to do anything, can't make the installer recognize it. So I went to the github page he also linked, DL it, get the installer to add it. Then I open the .ino file, try to compile, get a compile error many times saying it's calling to a library called MIDI that doesn't exist, it suggests I try MISO? Man this is frustrating. I imagine I've spent the better part of a day on this all together. I'm really frustrated. Have I angered the Gods?

Did you try installing the library through the Arduino IDE?

Select Tools/Manage Libraries... Or Ctrl-Shift-L

I searched for "arduino-midi-library" and it was there.



edit: My screenshot has the wrong library highlighted. Its one called MIDI Library. Same author as the GitHub

DC to Daylight fucked around with this message at 23:47 on May 27, 2022

petit choux
Feb 24, 2016

DC to Daylight posted:

Did you try installing the library through the Arduino IDE?

Select Tools/Manage Libraries... Or Ctrl-Shift-L

I searched for "arduino-midi-library" and it was there.



edit: My screenshot has the wrong library highlighted. Its one called MIDI Library. Same author as the GitHub

I did try that. And I try to compile and get a few dozen errors. I don't know what I'm doing and I don't want to further waste anybody's time. I probably just need to do some of those prepackaged projects that actually walk you through it instead of just going with one blog post that clearly assumes you already know how to do it all. Sorry and thanks, maybe I'll bring a working project over here sometime.

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

I don't think anyone is going to mind you posting nonworking stuff in here and asking for help

petit choux
Feb 24, 2016

taqueso posted:

I don't think anyone is going to mind you posting nonworking stuff in here and asking for help

Okay thanks. Right now I'm pulling out my hair and getting ready to hit myself in the head and stuff so I'll try again later.

Rexxed
May 1, 2010

Dis is amazing!
I gotta try dis!

petit choux posted:

I did try that. And I try to compile and get a few dozen errors. I don't know what I'm doing and I don't want to further waste anybody's time. I probably just need to do some of those prepackaged projects that actually walk you through it instead of just going with one blog post that clearly assumes you already know how to do it all. Sorry and thanks, maybe I'll bring a working project over here sometime.

Paste the errors into the forum, we don't have much to go on if you added the libraries but it can't find them when it's compiling the sketch. Arduino code is similar to C, C++, Java, etc. where the #include at the top of the file tells it which libraries to pull in so it can use the functions in them.

petit choux
Feb 24, 2016

Rexxed posted:

Paste the errors into the forum, we don't have much to go on if you added the libraries but it can't find them when it's compiling the sketch. Arduino code is similar to C, C++, Java, etc. where the #include at the top of the file tells it which libraries to pull in so it can use the functions in them.

I'm so sorry, I was kinda in a bad mood yesterday. I'll try it again. I'm still hoping there's a simple procedural detail that people who have experience in this stuff do reflexively and as soon a I get the bugs ironed out maybe I can do stuff like this without tearing my clothing or hair out. Arduino isn't my thing ordinarily, although I am in fact building up a DIY kit that has an Arduino as its core. Pretty excited about it too, they just put out a second revision too:



They're using an open source project and selling it as a DIY kit, and I was proud to have succeeded in soldering it together, it was the most demanding soldering job I had done to this point and still not that good at it. It works fabulously, in my mind it's one of the best new instruments out there. This company appears to be a bunch of hipsters who name all their products after coffee drinks from Starbucks or something, but this product is solid:

https://zeppelindesignlabs.com/product/altura-mkii-theremin-midi-controller/

petit choux
Feb 24, 2016

yeah, I'm looking at some of the documentation from the Sparkfun page about this MIDI shield and there appear to be a lot of really cool things I can do with this, I dunno, it looks really cool!

petit choux
Feb 24, 2016

Rexxed, since you have been so kind as to ask me to do that, I will soon. I have a few projects going on at the same time and this one hasn't been the highest priority. When I get my ducks lined up I'll attempt to do it again and be ready to show my work here.

Adbot
ADBOT LOVES YOU

Rexxed
May 1, 2010

Dis is amazing!
I gotta try dis!

No problem, I have a lot of projects too!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply