[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself


View post   

File: 117 KB, 1000x1000, arduino.jpg [View same] [iqdb] [saucenao] [google]
1299580 No.1299580 [Reply] [Original]

So i bought a arduino,some leds, breadboard, leads and I have used the arduino to blink a led.
What other cool projects are there to do with the arduino?

>> No.1299588

>it's another I bought an arduino I don't know what to do thread
at least you didn't buy it to learn programming
http://lmgtfy.com/?q=cool+projects+with+arduino

>> No.1299692

>>1299580
Insert directly into anus and talk about arduino projects. You'll be inspired.

>> No.1299697

>>1299692
Why so hostile? Daddy beat you up when you were a kid?

>> No.1299783
File: 135 KB, 600x600, diy_bingo.jpg [View same] [iqdb] [saucenao] [google]
1299783

>>1299697
See
>>1299588


We have this thread everyday at the cost of a valid one, typically from massive faggots like you whom seem to never read the stickies.

Enjoy learning c++ libraries that are badly documented and not applicable anywhere else.

Or you can use my previous response to help you find and answer.

>> No.1299823
File: 110 KB, 682x902, 1513786443957.jpg [View same] [iqdb] [saucenao] [google]
1299823

>>1299580
buy/pirate this book

>> No.1299855
File: 1.18 MB, 600x3849, 1513786449857_1.jpg [View same] [iqdb] [saucenao] [google]
1299855

>>1299823

>> No.1300018
File: 175 KB, 1329x946, arduino-mega-pinout-diagram.png [View same] [iqdb] [saucenao] [google]
1300018

Little known fact: the arduino mega costs about the same as the UNO ($11 or so on amazon), but it comes with an LED pre-installed on digital pin 13.

I can't exaggerate how much time that has saved me over the years.

>> No.1300020

>>1299783
>from massive faggots like you whom seem to never read the stickies.

This has to be one of the most egregious misuses of the word whom in the history of nerds trying to appear educated.

The rule is: if you are a dumbass NEVER USE WHOM because you will always use it wrong.

>> No.1300033

>>1300020
Is this the Anon to whom you were referring: >>1299783?

>> No.1300037

>>1300033

yeah, that's the clown whom doesn't know standard english.

I have to confess that both my parents taught middle school english, so I have an advantage.

>> No.1300052

>>1299580
>I have used the arduino to blink a led.
>What other cool projects are there to do with the arduino?

Use it to blink two LEDs?

>> No.1300058

>>1300052

I don't want to be that guy who asks for spoon fed but could you give me a hint on the sketch for that? I have the single led blink sketch already in my sketchbook.

>> No.1300131

>>1300020
Great. Now this is a diy grammar thread.

>> No.1300145

>>1300131
Whom'st

>> No.1300155

>>1300018
uh what?
my UNO rev3 comes with a led in pin 13 as well? i thought that was the norm?

>> No.1300454
File: 189 KB, 322x448, Screen Shot 2017-09-22 at 12.03.50 PM.png [View same] [iqdb] [saucenao] [google]
1300454

>>1299588
ha i know right. I definitely know what you are saying. hey tell the ones who don't get it where they should start with learning how to program, namely how programming works, like the basics you know?

for the ones who don't get it.

>> No.1300474

>>1299580
Make it so a light goes on when you fart

>> No.1301511

>>1300155
Off-brand unos don’t, but off-brand Megas do.

>> No.1301836

I’ve rigged one up in my garage to act as a kind of thermostat. Too cold? Runs a heater. Too hot? Opens an exhaust vent/fan and runs a fan by my desk. It also automatically turns on the garage door lights when you switch on the lights in the back. The heater/fan only run when the light is on, and it’s really nice only having to hit one switch instead of walk all over to hit three or four. Now that it’s colder out I think I’ll make another batch of code so I can have it start the heater 30 minutes before I head down to work first thing in the morning if it’s cold in the garage.

>> No.1302138

>>1299580
https://www.youtube.com/watch?v=VFGHY46K_HA
mine:
https://www.youtube.com/watch?v=FqRT90_j7Xc

>> No.1302211

pol/thread/154450688

>> No.1302222

>>1302138

I like yours. I skipped around a bit - does it turn blue at the end?

Many years ago I made an analog circuit to simulate sunrise to help wake me up gently as compared to an alarm. I used a cheap alarm clock to start it off, a very slow opamp ramp and an SCR to dim a conventional incandescent light bulb.

The light bulb filament would buzz loud enough to wake me up so it didn't accomplish anything, and probably would have gone through a bulb in a few days, but it was a fun electronics project.

>> No.1302280

>>1300454
>where they should start with learning how to program
Processing

>> No.1302295

>>1300052
It surely is him, whom is nuts. An absolute madman i say!

>> No.1302807

>>1299580
>blink a led
level up, pwm the led!

>> No.1302846

>>1302138

You could do even better: get a spectrometer and put it outside to capture the exact color of the sun in real time. Then you could use some arduinos to analyze the spectrum and emulate it perfectly. You can even get IR and UV LEDs to make it even more realistic.

Luckily, I have a window. So I use that.

>> No.1302882

>>1299580
http://www.atmel.com/images/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf

>> No.1303318

>>1300145
Whomstve

>> No.1303407

>>1299580
im in the process of making a sound reactive desk lamp with an arduino, sound detector and rgb led strip.

when i say in the process i mean, i just got the rgb led strip and when trying to follow the instructions noticed my led strip has an extra terminal on it for some fucking reason so naturally it got put into the "do it later" box.

>> No.1303824

>>1300018
Don't all arduinos have an LED on one of the digital pins?

>> No.1303825

>>1303824
that idiot just wanted to sound smart
>Little known fact
what a fucking imbecile

>> No.1304519

>>1300037
And yet you did manage to fuck up. Is >>1299783 one of the people whom your parents taught English?

>> No.1304583

>>1304519
Everyone is a fone poster

>> No.1305271

>>1299580
https://www.youtube.com/watch?v=23kjd_Ijlwk

>> No.1306498

Learn AutoSAR

>> No.1306504

>>1300018
>I can't exaggerate how much time that has saved me over the years.
Regardless of the other shit you got blasted for, how did this save you??

>> No.1306505

I've been pondering turning my Arduino and a spare lawnmower and parts into a yard Roomba

>> No.1306506

>>1303407
>my led strip has an extra terminal on it for some fucking reason
Maybe it's an all purpose power terminal and PWM is used for the RGB control logic but not power draw? What strip was it?

>> No.1306508

>>1306505
Depending on how much shit you wanna throw at it, you could plop on a GPS+9dof and make up some waypoint autonomy

>> No.1306513

>>1306508
I'm more concerned with ant beds, steep terrain, and ROCKS.
The kind of rocks that would go under touch sensors but above blade height.

>> No.1306528

You shouldn't pay more than a dollar each for microcontrollers.

>> No.1306530
File: 9 KB, 645x386, tiqY6Fg[1].png [View same] [iqdb] [saucenao] [google]
1306530

>>1306513
That's pretty solvable if you plop a touch sensor out in front of the blade at it's vertical level, with a little bit of force keeping it in the unpressed position. Grass wouldn't be enough to trigger it but anything solid would.

Pic related, blue = blade, orange = microswitch, purple = rock detector.

An actual good arduino //programming// project would be a little mini-robot that you could get your software running on indoors, and throw a bunch of obstacles at to make sure your programming would do good obstacle avoidance before you throw it on a motorized death machine that would cost money every time it hits something and breaks the blade.

>> No.1306536

>>1306530
Well the idea was build something to ensure all of the sensors worked well together before I start mounting it to a metal death tank.
For my particular yard, I'll still have to weed eat or mow a lot of areas that this thing couldn't do.

>> No.1306539

>>1306528
For the raw chips maybe, if you're putting them on a PCB I could see that. But prototyping on those is impossible and using a breakout board is easier and can be used for a ton of different projects over time

>> No.1306668

>>1306530
Should definitely have a bumper sensor on the rear for neighborhood kids that try to walk back there

>> No.1306734

>>1305271
what is this?

>> No.1306821

This is it, I'm going crazy. I think the avr-gcc compiler is fucking something up. I'm using an arduino with an atmega328p. Can anyone please help me out and just compile this code with avr-gcc -c -Wall -Os -DF_CPU=16000000UL -mmcu=atmega328p and then use avr-objdump -D -m avr5 and post the result?

#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

#define BLINK_DELAY_MS 200

ISR (INT0_vect) {
// switch pin 0 of PORTB while leaving the rest as is
PORTB &= ~(1 << PORTB5);
}
ISR(BADISR_vect){
PORTB |= (1 << PORTB5);
}
int main (void){
DDRB |= 1 << DDB5;
DDRD &= ~(1 << DDD2);
PORTD |= (1 << PORTD2);

//set INT0 to trigger on falling edge
EICRA |= (1 << ISC01);
//Turns on INT0
EIMSK |= (1 << INT0);
//SEt Interrupts
sei();

while(1) {
PORTB ^= 1 << PORTB5;
_delay_ms(BLINK_DELAY_MS);
}
}

I get some very weird assembly, here's while loop in assembly

14: 90 e2 ldi r25, 0x20 ; 32
16: 85 b1 in r24, 0x05 ; 5
18: 89 27 eor r24, r25
1a: 85 b9 out 0x05, r24 ; 5
1c: 2f ef ldi r18, 0xFF ; 255
1e: 33 ec ldi r19, 0xC3 ; 195
20: 89 e0 ldi r24, 0x09 ; 9
22: 21 50 subi r18, 0x01 ; 1
24: 30 40 sbci r19, 0x00 ; 0
26: 80 40 sbci r24, 0x00 ; 0
28: 01 f4 brne .+0 ; 0x2a <main+0x2a>
2a: 00 c0 rjmp .+0 ; 0x2c <main+0x2c>
2c: 00 00 nop
2e: 00 c0 rjmp .+0 ; 0x30 <__vector_default+0x1a>

What the hell is going on at those last jumps? Why does it jump into the interrupt routine instead of jumping back to do the delay and the outer while loop?
I can turn the LED on/off depending on which interrupt function I put first in the source code, because it just jumps into the second one. Any help appreciated, I'm just confused as hell about this.

>> No.1306890

>>1306821
could be some compiler optimizations related with the delay macro

>> No.1306904

>>1306821
why do you need interrupts to blink a LED if it's being done in the main loop.
also 99.99% of the time it's user error and not the fault of the compiler.
and you are missing a main function, if you want help, at least post the full code to pastebin

>> No.1306905

>>1306904
nevermind, i see the main function. still post to somewhere that uses syntax highlighting.

>> No.1307019

>>1306821
>_delay_ms
http://www.atmel.com/webdoc/avrlibcreferencemanual/group__util__delay_1gad22e7a36b80e2f917324dc43a425e9d3.html
>The maximal possible delay is 262.14 ms / F_CPU in MHz.
>CPU=16000000UL
262/16 = 16ms
>BLINK_DELAY_MS 200
maybe read the documentation occasionally

>> No.1307046
File: 341 KB, 2073x1046, arduino.jpg [View same] [iqdb] [saucenao] [google]
1307046

I'm new to Arduino and having problems understanding schematics

Can anyone explain how to connect the black wire? It starts at resistors(?) and goes all the way to GND on microcontroller. There's too much merging on the way and I have no idea how to connect them

>> No.1307047
File: 194 KB, 2022x694, Breadboard.jpg [View same] [iqdb] [saucenao] [google]
1307047

>>1307046

You can use this to map out the connections

Thanks in advance

>> No.1307054

>>1307046
>Two resistors in parallel for LEDs

xcuse me wat r u doin?

>> No.1307056

>>1307054
just following this guide: https://www.instructables.com/id/O-mat/

Not sure about those LEDs, they serve no purpose..

>> No.1307083

>>1306904
I want to use interrupts, this is just the first example. I'm not missing a main function, it's right there.
https://pastebin.com/wHaGAH8v
Here's the C code. Forgot about pastebin.

>>1307019
>When the user request delay which exceed the maximum possible one, _delay_ms() provides a decreased resolution functionality. In this mode _delay_ms() will work with a resolution of 1/10 ms, providing delays up to 6.5535 seconds (independent from CPU frequency). The user will not be informed about decreased resolution.

Maybe you should read the documentation.

Anyways when I disassemble the produced hex file and not the object file, the delay and while loop work out. But my real problem is that the program starts inside the interrupt vector. It never gets to the main function.

https://pastebin.com/xshz6isX

Here's the disassembled hex file that gets loaded into the arduino. What we should see is a rjmp to the main function at 00, and an rjmp to the INT0_vector function at 02 as per the interrupt vector addresses. Instead it starts right inside the interrupt function and then with reti it gives back control to the bootloader which calls the address 00 in the first place. Then the arduino restarts.

https://pastebin.com/WY1hiCf4

I rearranged the main and interrupt function and added the rjmps at the correct addresses, and everything works as expected, the led blinks every 0.5 seconds unless I pull pd2 down to 0, then it toggles right there and then.

Am I using the wrong commands for compiling?
avr-gcc -c -Wall -Os -DF_CPU=16000000UL -mmcu=atmega328p -o ./foo.o ./foo.c
avr-gcc ./foo.o -o ./foo
avr-objcopy -O ihex -R .eeprom foo ./foo.hex

What is going on?

>> No.1307089

>>1307046
you connect all black wire (GND) together and all the resistor that touch it, stop being dumb.

>> No.1307096
File: 140 KB, 1192x823, Screenshot_126.jpg [View same] [iqdb] [saucenao] [google]
1307096

>>1307089

Explain this? Obviously I don't have wires that split up like that

>> No.1307098
File: 201 KB, 2022x694, conn.jpg [View same] [iqdb] [saucenao] [google]
1307098

>>1307096
>>1307089
>>1307046

Does this make sense?
I never dabbled with electronics before, it's beyond confusing to me

>> No.1307101

>>1307096
Are you retarded? Holly shit. Don't do electronics if you are literally retarded. First learn basics for babies instead of starting with arduino.
http://lmgtfy.com/?q=how+to+read+electronic+schematics

>> No.1307104

>>1307098
Do you seriously think that retard, who doesn't know how to connect some wires together, has a breadboard or knows how to use it?

>> No.1307105

>>1307104
thanks for the help

>> No.1307107

>>1306904
>also 99.99% of the time it's user error and not the fault of the compiler.
I'd give the guy some slack, avr-gcc really is a pile of garbage.

>> No.1307109
File: 181 KB, 1213x416, omatbb1.jpg [View same] [iqdb] [saucenao] [google]
1307109

>>1307105
here, now stop being stupid

>> No.1307110

>>1307105
also this
https://www.youtube.com/watch?v=ywHcssUjXD0

>> No.1307117

Build a chair or a birdhouse

>> No.1307138

>>1307083
Ok I solved it, if you want to use interrupts you have to compile with the -Wl,--gc-sections flag, else it won't use the interrupt vector table.

>> No.1307243

I'm trying to stream an online radio to my FM radio through a raspberry pi but I can't get the streaming to work.
Streaming a .wav just works fine but I can't stream from the links or the m3u and pls files.
Could somebody show me the right direction please?

>> No.1307247

>>1307243
>I'm trying to stream an online radio to my FM radio through a raspberry pi
how?

>> No.1307653

>>1299697
>Daddy beat you up when you were a kid
Hot.

>> No.1307778

>>1299580
I'm planning on making a MIDI controller with it.

>> No.1308267

>>1299580
nope, that's it, you're done. time to put it in a drawer and move on to the next meme.

>> No.1309482

>>1300474
I laughed way too hard at this