pomeroyb / PortalGun

Code to control a Portal Gun (From Rick and Morty)
32 stars 19 forks source link

Rotary encoder issue. #9

Open shwifty8790 opened 6 years ago

shwifty8790 commented 6 years ago

I'm super inexperienced with coding so I'm curious about changing the button presses. I want a long press to power off/ on and the audio for the portal open to be a single click and portal close to be a double click. Any idea how I would go about changing that up? Thanks in advance.

shwifty8790 commented 6 years ago

Additionally I'm wondering if I can plug in the whole code (copy/paste) with the descriptions included or will that cause errors?

pomeroyb commented 6 years ago

Hey there,

You'll want to use the SFX branch. Unfortunately I gave up on SFX personally, but the functionality should all be there. The button presses are between line 144 and line 193 on that branch, and you can add the sound effects to the respective button pattern there.

If you use the main branch, you should be able to just copy paste the relevant code in -- there's not huge differences between the code bases.

Good luck!

shwifty8790 commented 6 years ago

So use the SFX branch for the button controls as well or keep the potentiometer in the rotary encoder section? And are there any sections of code that should be omitted for any reason? Sorry for all the questions. I'm the textbook definition of a noob lol.

On Sep 19, 2017 5:51 PM, "Brandon Pomeroy" notifications@github.com wrote:

Hey there,

You'll want to use the SFX branch. Unfortunately I gave up on SFX personally, but the functionality should all be there. The button presses are between line 144 and line 193 on that branch, and you can add the sound effects to the respective button pattern there.

If you use the main branch, you should be able to just copy paste the relevant code in -- there's not huge differences between the code bases.

Good luck!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pomeroyb/PortalGun/issues/9#issuecomment-330713792, or mute the thread https://github.com/notifications/unsubscribe-auth/Aen8bx6A4_Aj0xWD-oQaChEHObK4aMxiks5skGGJgaJpZM4PdAoF .

shwifty8790 commented 6 years ago

Forgot to ask what speaker you used and if there might be a better one to use. I'd like my gun to have the sound feature but it's not going to make or break the project.

shwifty8790 commented 6 years ago

Lastly. Will I need a wav file backpack for the trinket pro or is it capable of storing the 2 sounds?

pomeroyb commented 6 years ago

The trinket doesn't have any sound capabilities built in, so you will need an Adafruit FX board.

I used these products (Also listed in the top of the .ino file)

The reason I dropped the FX from the project is because the speaker I used wasn't super loud, and the FX board drained the battery much faster than the trinket in sleep mode. At the very least, I'd do some research on ways to make the speaker louder.

The main branch and the sfx branch should be pretty similar in the controls section... but it's been a while and I don't remember all the differences. Your best bet is to start with the main branch, and copy paste features from the SFX branch over 1 by 1 to make sure there aren't any problems.

Good luck!

shwifty8790 commented 6 years ago

How quick of a drain are you talking about? I bought the charging backpack for the trinket so in theory that should eliminate or at least reduce the annoyance of a dead battery.

On Sep 19, 2017 7:16 PM, "Brandon Pomeroy" notifications@github.com wrote:

The trinket doesn't have any sound capabilities built in, so you will need an Adafruit FX board.

I used these products (Also listed in the top of the .ino file)

The reason I dropped the FX from the project is because the speaker I used wasn't super loud, and the FX board drained the battery much faster than the trinket in sleep mode. At the very least, I'd do some research on ways to make the speaker louder.

The main branch and the sfx branch should be pretty similar in the controls section... but it's been a while and I don't remember all the differences. Your best bet is to start with the main branch, and copy paste features from the SFX branch over 1 by 1 to make sure there aren't any problems.

Good luck!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pomeroyb/PortalGun/issues/9#issuecomment-330725605, or mute the thread https://github.com/notifications/unsubscribe-auth/Aen8b4uDgtj4D-UJ-uSRenSFtauKV_okks5skHVygaJpZM4PdAoF .

pomeroyb commented 6 years ago

Without the sfx board, my gun can go multiple days without a charge while in sleep mode (I haven't tested with the LEDs on constantly). When the trinket is put to sleep, it consumes an extremely small amount of power

With the sfx board, the gun only had battery for ~two hours while in sleep mode. I could not find a way to make the sfx board use less power. YMMV, but the sfx board was not worth it for me (Especially with how quiet my speaker was)

shwifty8790 commented 6 years ago

Damn that's not long at all. Well I might just go back to it later once I have a bit more experience under my belt and have done the research into extending the battery life.

On Sep 19, 2017 7:29 PM, "Brandon Pomeroy" notifications@github.com wrote:

Without the sfx board, my gun can go multiple days without a charge while in sleep mode (I haven't tested with the LEDs on constantly). When the trinket is put to sleep, it consumes an extremely small amount of power

With the sfx board, the gun only had battery for ~two hours while in sleep mode. I could not find a way to make the sfx board use less power. YMMV, but the sfx board was not worth it for me (Especially with how quiet my speaker was)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pomeroyb/PortalGun/issues/9#issuecomment-330727412, or mute the thread https://github.com/notifications/unsubscribe-auth/Aen8b9bNGamKQsxysdlePzYcMGqlhOI0ks5skHiMgaJpZM4PdAoF .

shwifty8790 commented 6 years ago

Just had a thought on the SFX. Would a more powerful battery solve the audio/ power issues? Like a 12 volt battery or 2 18650's 500mah?

On Sep 19, 2017 7:32 PM, "jake smallman" jsmalls90@gmail.com wrote:

Damn that's not long at all. Well I might just go back to it later once I have a bit more experience under my belt and have done the research into extending the battery life.

On Sep 19, 2017 7:29 PM, "Brandon Pomeroy" notifications@github.com wrote:

Without the sfx board, my gun can go multiple days without a charge while in sleep mode (I haven't tested with the LEDs on constantly). When the trinket is put to sleep, it consumes an extremely small amount of power

With the sfx board, the gun only had battery for ~two hours while in sleep mode. I could not find a way to make the sfx board use less power. YMMV, but the sfx board was not worth it for me (Especially with how quiet my speaker was)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pomeroyb/PortalGun/issues/9#issuecomment-330727412, or mute the thread https://github.com/notifications/unsubscribe-auth/Aen8b9bNGamKQsxysdlePzYcMGqlhOI0ks5skHiMgaJpZM4PdAoF .