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
SoundMonkey
Apr 22, 2006

I just push buttons.


Collateral Damage posted:

If your bike has an OBD plug (or some other CAN bus access) there are a few CAN/OBD shields which will let you get a lot of that data straight from the engine controller.

Though if you want something for a non-ECU engine you probably have to put a bunch of sensors all over it yourself.

If the latter ends up being the case, probably the best way to proceed is by picking a protocol (I2C, TWI, SPI, etc) and buying your sensors based on that, as opposed to some goddamn hellscape of different communication methods and ADCs for analog stuff and oh god.

...not that I ever made that mistake before or anything.

Adbot
ADBOT LOVES YOU

ReelBigLizard
Feb 27, 2003

Fallen Rib

Sh4 posted:

Anyone interested about working together on a motorbike computer project, was thinking about functions like speedo, mileage, fuel level, oil warning, water temp, maybe RPM too but I have no idea how to proceed.
I'm decent at code but I have never did any electronics. I'm pretty sure there's a market for it too, as all my racing 2 strokes buddies are complaining all the time that aftermarket computers are terrible or way too expensive.

I'm interested in working on something like that. As a motorcyclist myself I am also frustrated by the lovely offerings for aftermarket gauges. There's a some useful modules out there already:

https://www.tindie.com/products/TheRengineer/analog-gauge-stepper-breakout-board/

A cluster with an analogue dial that can change measurements according to preference would be cool, maybe with OLED like that keyboard that can change it's keys. Like I want the main dial to be RPM and the speed to be on the digital display, or the speed to be the dial with the RPM on the digital display, or I have an electric bike and I want the dial to be the battery / efficiency measurement.

It's the kind of thing that you could never put on a bike OEM because of regulations.

Sh4
Feb 8, 2009

ReelBigLizard posted:

I'm interested in working on something like that. As a motorcyclist myself I am also frustrated by the lovely offerings for aftermarket gauges. There's a some useful modules out there already:

https://www.tindie.com/products/TheRengineer/analog-gauge-stepper-breakout-board/

A cluster with an analogue dial that can change measurements according to preference would be cool, maybe with OLED like that keyboard that can change it's keys. Like I want the main dial to be RPM and the speed to be on the digital display, or the speed to be the dial with the RPM on the digital display, or I have an electric bike and I want the dial to be the battery / efficiency measurement.

It's the kind of thing that you could never put on a bike OEM because of regulations.

That would be cool but I think that would be hell to make it weatherproof, I was thinking of a single screen oled or digital whatever is better

TheresaJayne
Jul 1, 2011

ReelBigLizard posted:

I'm interested in working on something like that. As a motorcyclist myself I am also frustrated by the lovely offerings for aftermarket gauges. There's a some useful modules out there already:

https://www.tindie.com/products/TheRengineer/analog-gauge-stepper-breakout-board/

A cluster with an analogue dial that can change measurements according to preference would be cool, maybe with OLED like that keyboard that can change it's keys. Like I want the main dial to be RPM and the speed to be on the digital display, or the speed to be the dial with the RPM on the digital display, or I have an electric bike and I want the dial to be the battery / efficiency measurement.

It's the kind of thing that you could never put on a bike OEM because of regulations.

I had dreams when younger to replace my car dash with a touch screen that was reconfigurable like the Consoles on Star Trek the Next Degradation.
Now i am bitter, twisted and writing code for pokemon on minecraft....

ReelBigLizard
Feb 27, 2003

Fallen Rib

Sh4 posted:

That would be cool but I think that would be hell to make it weatherproof, I was thinking of a single screen oled or digital whatever is better

Trailtech have got that market pretty much cornered - http://www.trailtech.net/digital-gauges

EDIT: besides, I've got some ideas for non OLED solutions now, and a novel idea for how to make the guage adapt.

I might mock something up in html5 and see how it looks.

ReelBigLizard fucked around with this message at 17:03 on Mar 27, 2015

n0tqu1tesane
May 7, 2003

She was rubbing her ass all over my hands. They don't just do that for everyone.
Grimey Drawer

TheresaJayne posted:

I had dreams when younger to replace my car dash with a touch screen that was reconfigurable like the Consoles on Star Trek the Next Degradation.
Now i am bitter, twisted and writing code for pokemon on minecraft....

All you need for that on modern cars is a bluetooth OBDII reader and an Android tablet.

Here's an Android tablet that's got a dash cam, GPS, radar detector, and a bunch of other stuff built in. http://www.dx.com/p/7-capacitive-screen-android-4-1-car-gps-navigator-table-pc-w-wifi-car-radar-detector-car-dvr-353416#.VRYozC7ZWXk

PRADA SLUT
Mar 14, 2006

Inexperienced,
heartless,
but even so
Where can you get one of those baseplates that hold an Arduino and a breadboard? Just the plastic piece alone (I guess it could include a breadboard if needed).

Hadlock
Nov 9, 2004

Anything arduino accessory related: search ebay, then filter by results shipping from the USA/North America. You pay a dollar or two more than having it shipped direct from China, but it arrives in 2-4 days, instead of 6-8 weeks.

I ended up sanding down a nice pice of 1x5 board and screwing down the breadboard, etc. There's an arduino under two shields here, and in the bottom right are two mini bread boards screwed down to a second board.



I forget what those big bolt posts were for, probably an old Beaglebone Black or Intel Galileo.

Hadlock fucked around with this message at 06:56 on Mar 30, 2015

Jonny Quest
Nov 11, 2004

Tackled my first Arduino project using some Chinese Digispark clones from eBay and turned them into a volume up/down/mute controller. Windows-compatible code came from Adafruit from one of their Trinket projects.



The knob is just a 1" cutting of 2" aluminum round rod that I hot glued (repeatedly) to a nut and polished on my cordless drill. Base is some scraps of sapele covered in Danish oil that I quickly glued together to hold the chip and rotary encoder.

All in about $8 of parts and an embarrassing amount of time trying to learn about Digisparks and uploads and Windows media key formats.

SoundMonkey
Apr 22, 2006

I just push buttons.


holy. loving. poo poo.

Time to buy a dozen more of these. I have one but I don't have any 3.3V boards and re-flashing it looked tedious but oh hey now there's a thing with an Arduino IDE that's basically a halfassed (SPI and I2C aren't fully implemented) Arduino with wifi for four dollars.

e: I mean now the problem will be that not enough of the pins are broken out on most of the eBay boards, but we're halfway there.

ReelBigLizard
Feb 27, 2003

Fallen Rib
Props to squirrel-labs.net (:britain:)

Ordered thirty 5mm Neopixel clones from their ebay shop, got them in 2 days with free postage and they threw in three 8mm ones and a discount code for their regular site.

Gave the 8mms to a coworker who gave me an Arduino pro mini clone for the gauge cluster idea.


That is loving sweet.

Sebbe
Feb 29, 2004

SoundMonkey posted:

e: I mean now the problem will be that not enough of the pins are broken out on most of the eBay boards, but we're halfway there.

The ESP-12 is pretty good for getting lots of pins.

Acid Reflux
Oct 18, 2004

SoundMonkey posted:

holy. loving. poo poo.

Time to buy a dozen more of these. I have one but I don't have any 3.3V boards and re-flashing it looked tedious but oh hey now there's a thing with an Arduino IDE that's basically a halfassed (SPI and I2C aren't fully implemented) Arduino with wifi for four dollars.

e: I mean now the problem will be that not enough of the pins are broken out on most of the eBay boards, but we're halfway there.

I feel like a big dummyface, but just for clarification - can these actually be used by themselves to interface with stuff without requiring a separate microcontroller? Like, if I wanted to wirelessly monitor the water level in my coffee pot (for whatever reason people do this) all I'd need is one of these and the appropriate code and sensor?

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass

Acid Reflux posted:

I feel like a big dummyface, but just for clarification - can these actually be used by themselves to interface with stuff without requiring a separate microcontroller? Like, if I wanted to wirelessly monitor the water level in my coffee pot (for whatever reason people do this) all I'd need is one of these and the appropriate code and sensor?

Yes, but be careful because there might not be a library to talk to your sensor. I think someone mentioned the board doesn't do SPI or I2C yet so that rules out a lot of things. I'm also not sure it has an ADC so you definitely need to do some homework first.

Acid Reflux
Oct 18, 2004

mod sassinator posted:

Yes, but be careful because there might not be a library to talk to your sensor. I think someone mentioned the board doesn't do SPI or I2C yet so that rules out a lot of things. I'm also not sure it has an ADC so you definitely need to do some homework first.

All good info, thanks. :) I don't really have anything in mind yet that I'd need that kind of functionality for, but as I continue to fumble through some basic home automation prototype projects, I imagine something will pop up eventually.

SoundMonkey
Apr 22, 2006

I just push buttons.


mod sassinator posted:

Yes, but be careful because there might not be a library to talk to your sensor. I think someone mentioned the board doesn't do SPI or I2C yet so that rules out a lot of things. I'm also not sure it has an ADC so you definitely need to do some homework first.

I just went and actually read the article for a change and apparently it's only I2C/SPI *slave* modes that aren't fully working yet. Also PWM is looking a bit challenging.

edit: that DX board seems to imply this thing has one singular ADC, which luckily is all I need for most stuff. If SoftwareSerial works, this thing basically owns.

SoundMonkey fucked around with this message at 00:12 on Apr 4, 2015

Data Graham
Dec 28, 2009

📈📊🍪😋



Any Arduino-heads in here who are handy with the C++ side of things?

Hi,

I'm trying to use this Telit GPRS library here: http://wiki.groundlab.cc/doku.php?id=gsm_arduino_library

I'm having trouble getting it to compile with an Arduino Mega. I'm well versed in regular Arduino programming, but I'm very rusty on my C++, and so I don't really know where to start in debugging the issues, namely:

code:
no matching function for call to 'gsmGPRS::gsmGPRS(HardwareSerial&, long unsigned int (*)(), HardwareSerial*)'
and (in gsmbase.h)

code:
typedef HardwareSerial Serial;      // change here to support your serial friend
                                // Serial needs a read, write, flush, available functions

-> error: 'HardwareSerial' does not name a type
Can someone with a Mega please try installing this library and seeing if you can get it to compile? The software seems to be abandonware (I can't easily track down the author), but it looks like it has a lot of potential, it was just apparently written in a way that doesn't play nicely with the Mega's built-in Serial ports.

Thanks...

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
What if you comment out that typedef that defines HardwareSerial as Serial? IIRC the Arduino libraries nowadays have a small type hiearchy with a base Serial type and concrete SoftwareSerial and HardwareSerial implementations.

edit: Actually try replacing that typdef with this:
code:
typedef Stream Serial;
Looking at the Arduino code their HardwareSerial class has Stream as a base class. Switching this library's Serial interface to Stream should probably work, assuming they use the same interface as Stream.

mod sassinator fucked around with this message at 01:28 on Apr 9, 2015

Data Graham
Dec 28, 2009

📈📊🍪😋



Hmm, doesn't seem to. After changing that typedef as you suggested, I get this:

code:
In file included from /Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmGPRS.h:23,
                 from GPRS_test.ino:1:
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmbase.h:43: error: 'Stream' does not name a type
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmbase.h:46: error: ISO C++ forbids declaration of 'Serial' with no type
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmbase.h:46: error: expected ';' before '&' token
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmbase.h:47: error: ISO C++ forbids declaration of 'Serial' with no type
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmbase.h:47: error: expected ';' before '*' token
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmbase.h:55: error: expected `)' before '&' token
In file included from GPRS_test.ino:1:
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmGPRS.h:37: error: expected `)' before '&' token
GPRS_test:24: error: no matching function for call to 'gsmGPRS::gsmGPRS(HardwareSerial&, long unsigned int (*)(), HardwareSerial*)'
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmGPRS.h:26: note: candidates are: gsmGPRS::gsmGPRS()
/Users/xxx/Documents/Arduino/libraries/GROUNDLAB/gsmGPRS.h:26: note:                 gsmGPRS::gsmGPRS(const gsmGPRS&)
GPRS_test.ino: In function 'void talkReply()':
GPRS_test:75: error: 'null' was not declared in this scope
And if I just comment out the typedef, I still get all the same errors from "ISO C++ forbids declaration of 'Serial' with no type" onward.

Data Graham
Dec 28, 2009

📈📊🍪😋



Okay—it compiles in the old Arduino 0023 IDE. Before they refactored basically everything.

It would be a worthwhile project to try to update it for the modern environment, but in the interest of time I may have to just go back to 0023 for my project. :shrek:

Anyone bored enough to want to work with me on that upgrade effort?

Acid Reflux
Oct 18, 2004

I ended up grabbing a few of those ESP-12 modules from eBay just for the hell of it.
They are very small.

Fanged Lawn Wormy
Jan 4, 2008

SQUEAK! SQUEAK! SQUEAK!
stupid question:

I want to use the arduino ethernet library, for example, which because of the arduino shields, has a hard-coded SPI pin.

what if I'm not using a shield and I wanted to change that pin for some reason? I figure I could:

edit the pin number in the library

OR
edit the library to accept a pin argument as part of the setup

Or, is there an easier way to do it, like a well placed #define or something?

Acid Reflux
Oct 18, 2004

OK, these little ESP8266 widgets are pretty awesome. I've only gone as far as blindly following this Instructable, but everything worked exactly as advertised. I still have no idea exactly what I'm going to do with them, but just seeing them in action - and realizing that I paid roughly $4 apiece for them - is just a little bit amazing.

I got mine from a US-based seller, five units for $2.95/ea with $3.49 shipping. They don't come with the little breakout board, so keep in mind that the pins are spaced at 2mm rather than 2.54mm/0.1 inch and won't fit on a standard breadboard. I made my own breakout with some strip board and scraps of solid core Cat5 cable. I don't recommend my method...in hindsight, I probably could have designed and etched a board in less time than it took me to make that little monstrosity. gently caress it though, it worked!

Captain Cool
Oct 23, 2004

This is a song about messin' with people who've been messin' with you

Acid Reflux posted:

They don't come with the little breakout board, so keep in mind that the pins are spaced at 2mm rather than 2.54mm/0.1 inch and won't fit on a standard breadboard. I made my own breakout with some strip board and scraps of solid core Cat5 cable. I don't recommend my method...in hindsight, I probably could have designed and etched a board in less time than it took me to make that little monstrosity. gently caress it though, it worked!
I had to do this recently with a tiny radio module. I came across a 14-pin "component carrier" at an electronics junk store. It's basically a DIP socket you can solder from the top. And the pins on the bottom are long enough to stick in a breadboard. You still need to figure out how to hold three pieces in place while you solder some hookup wire in place.

UberVexer
Jan 5, 2006

I like trains

PRADA SLUT posted:

Where can you get one of those baseplates that hold an Arduino and a breadboard? Just the plastic piece alone (I guess it could include a breadboard if needed).

I got one from a sparkfun dumpster dive at one point or another.

They sell them without breadboards for pretty cheap, but I'd guess it'd be hard to justify shipping one. https://www.sparkfun.com/products/11235

ejstheman
Feb 11, 2004
Three working ATMEGA 328P-PU chips, but two out of three UNO boards are fried. What the hell, Inland Micro?

At least they're socketed, so I can use the one working board to program all three chips. Wish I could find my loving receipt. Can I just breadboard these after I program them and use them that way, or do they need the board to function?

poeticoddity
Jan 14, 2007
"How nice - to feel nothing and still get full credit for being alive." - Kurt Vonnegut Jr. - Slaughterhouse Five

ejstheman posted:

Three working ATMEGA 328P-PU chips, but two out of three UNO boards are fried. What the hell, Inland Micro?

At least they're socketed, so I can use the one working board to program all three chips. Wish I could find my loving receipt. Can I just breadboard these after I program them and use them that way, or do they need the board to function?

If you don't have an external 16MHz crystal, you'll have to adjust some fuse settings to use another crystal or the internal oscillator, and you won't have serial, but otherwise they should be good to go for breadboarding.

ejstheman
Feb 11, 2004

poeticoddity posted:

If you don't have an external 16MHz crystal, you'll have to adjust some fuse settings to use another crystal or the internal oscillator, and you won't have serial, but otherwise they should be good to go for breadboarding.

How do you use the internal oscillator? A 16MHz crystal is cheap per each, but I assume not if I only need two of them, what with S&H.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
Check out the bottom of this page for details: http://arduino.cc/en/Tutorial/ArduinoToBreadboard

Amberskin
Dec 22, 2013

We come in peace! Legit!

poeticoddity posted:

If you don't have an external 16MHz crystal, you'll have to adjust some fuse settings to use another crystal or the internal oscillator, and you won't have serial, but otherwise they should be good to go for breadboarding.

Uh, I've built a contraption using 328P clocked with the internal oscillator (at 8MHz) and serial works just fine. I don't have the program at hand and I don't remember at which speed, but using a cheapo chinese FTDI board I can hook up to the UART and do stuff with it.

dirtycajun
Aug 27, 2004

SUCKING DICKS AND SQUEEZING TITTIES
So I have a MIDI project that is running fine on an UNO but for space and cost reasons I would prefer to have it run on a Trinket 5v. The project uses 5 pins which is convenient (RX and 2-5 are just LED on/off to run a solid state relay) as this is the number of available pins on the Trinket to work with. What isn't so great is that the MIDI library auto initializes pin 1 for TX and it can't be used for anything else (I am only receiving MIDI data in this project,) this works fine when testing it with the UNO but won't fly if I put it on the trinket.

So my question is how do I pair down the MIDI library so that it will run on the Trinket leaving me with all available pins and what I might have to change in my code from on the UNO version to function on a trinket. If I don't have to edit the library itself and instead just achieve this by way of just a change in my code that would be even better.

Just for the sake of inclusion here is what I am running on the Arduino side, the project is set up so that it receives MIDI input from a drum machine and then utilizes that to run a solid state relay to control 4 sets of two electrical outlets.

code:
#include <MIDI.h>
int socketOne = 0;
int socketTwo = 0;
int socketThree = 0;
int socketFour = 0;
int socketOn = 1;
int socketOff = -1;

MIDI_CREATE_DEFAULT_INSTANCE();
void handleNoteOn(byte channel, byte pitch, byte velocity)
{
  if (pitch == 36) {
    socketOne = socketOne + socketOn;
  }
  if (pitch == 38) {
    socketTwo = socketTwo + socketOn;
  }
  if (pitch == 40) {
    socketTwo = socketTwo + socketOn;
  }
  if (pitch == 26) {
    socketThree = socketThree + socketOn;
  }
  if (pitch == 42) {
    socketThree = socketThree + socketOn;
  }
  if (pitch == 51) {
    socketThree = socketThree + socketOn;
  }
  if (pitch == 53) {
    socketThree = socketThree + socketOn;
  }
  if (pitch == 55) {
    socketThree = socketThree + socketOn;
  }
  if (pitch == 41) {
    socketFour = socketFour + socketOn;
  }
  if (pitch == 45) {
    socketFour = socketFour + socketOn;
  }
  if (pitch == 48) {
    socketFour = socketFour + socketOn;
  }
}

void handleNoteOff(byte channel, byte pitch, byte velocity)
{
  if (pitch == 36) {
    socketOne = socketOne + socketOff;
  }
  if (pitch == 38) {
    socketTwo = socketTwo + socketOff;
  }
  if (pitch == 40) {
    socketTwo = socketTwo + socketOff;
  }
  if (pitch == 26) {
    socketThree = socketThree + socketOff;
  }
  if (pitch == 42) {
    socketThree = socketThree + socketOff;
  }
  if (pitch == 51) {
    socketThree = socketThree + socketOff;
  }
  if (pitch == 53) {
    socketThree = socketThree + socketOff;
  }
  if (pitch == 55) {
    socketThree = socketThree + socketOff;
  }
  if (pitch == 41) {
    socketFour = socketFour + socketOff;
  }
  if (pitch == 45) {
    socketFour = socketFour + socketOff;
  }
  if (pitch == 48) {
    socketFour = socketFour + socketOff;
  }
}

void setup()
{
  MIDI.setHandleNoteOn(handleNoteOn);
  MIDI.setHandleNoteOff(handleNoteOff);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
}

void loop()
{
  MIDI.read();
  if (socketOne > 0) digitalWrite (2, HIGH);
  if (socketOne == 0) digitalWrite (2, LOW);
  if (socketTwo > 0) digitalWrite (3, HIGH);
  if (socketTwo == 0) digitalWrite (3, LOW);
  if (socketThree > 0) digitalWrite (4, HIGH);
  if (socketThree == 0) digitalWrite (4, LOW);
  if (socketFour > 0) digitalWrite (5, HIGH);
  if (socketFour == 0) digitalWrite (5, LOW);
}

TheLastManStanding
Jan 14, 2008
Mash Buttons!
If you are receiving data, you are also sending data, whether you tell it to or not. If you need more pins, then you should look into multiplexing.

As for your code, it needs help. Your mass of if structures should be changed to a switch case and I'm not sure what you're doing with them: Why aren't you just stating 'socketOne= 1' and 'socketOne = 0', or the more proper 'socketOne = HIGH/LOW'. As a side note 's1 = s1 + sO' can just be writen 's1+=sO'. Thirdly, don't have digitalWrites every loop; only write when they change (this is something I bring up almost constantly and should probably be bolded in the OP). Stick them in the on/off state handlers.

Like this:

code:
#include <MIDI.h>
#define p1 2 // These are your pin numbers.
#define p2 3 // You should always define your pins
#define p3 4 // as it makes making changes later 
#define p4 5 // significantly easier

int s1 = 0;
int s2 = 0;
int s3 = 0;
int s4 = 0;

MIDI_CREATE_DEFAULT_INSTANCE();
void handleNoteOn(byte channel, byte pitch, byte velocity)
{
  switch (pitch) {
    case 36:
      digitalWrite(p1, HIGH);
      s1++;
      break;
    case 38:
      digitalWrite(p2, HIGH);
      s2++;
      break;
    case 40:
      digitalWrite(p2, HIGH);
      s2++;
      break;
    case 26:
      digitalWrite(p3, HIGH);
      s3++;
      break;
  }
}

void handleNoteOff(byte channel, byte pitch, byte velocity)
{
  switch (pitch) {
    case 36:
      s1--;
      break;
    case 38:
      s2--;
      break;
    case 40:
      s2--;
      break;
    case 26:
      s3--;
      break;
  }
  if(s1 == 0) digitalWrite(p1, LOW);
  if(s2 == 0) digitalWrite(p2, LOW);
  if(s3 == 0) digitalWrite(p3, LOW);
  if(s4 == 0) digitalWrite(p4, LOW);
}

void setup()
{
  MIDI.setHandleNoteOn(handleNoteOn);
  MIDI.setHandleNoteOff(handleNoteOff);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  pinMode(p1, OUTPUT);
  pinMode(p2, OUTPUT);
  pinMode(p3, OUTPUT);
  pinMode(p4, OUTPUT);
}

void loop()
{
  MIDI.read();
}
Edit: I see why you did it; multiple keys can trigger the same event. Fixed.

TheLastManStanding fucked around with this message at 20:00 on Apr 14, 2015

poeticoddity
Jan 14, 2007
"How nice - to feel nothing and still get full credit for being alive." - Kurt Vonnegut Jr. - Slaughterhouse Five

Amberskin posted:

Uh, I've built a contraption using 328P clocked with the internal oscillator (at 8MHz) and serial works just fine. I don't have the program at hand and I don't remember at which speed, but using a cheapo chinese FTDI board I can hook up to the UART and do stuff with it.

Interesting. Most of what I've read (caveat: largely snippets from electronics blog posts) has suggested that the variability in internal oscillators makes serial communication between chips without crystals relatively unreliable, but maybe that more an issues of extremes in opposite directions or something. :shrug:

dirtycajun
Aug 27, 2004

SUCKING DICKS AND SQUEEZING TITTIES

TheLastManStanding posted:

If you are receiving data, you are also sending data, whether you tell it to or not. If you need more pins, then you should look into multiplexing.

As for your code, it needs help. Your mass of if structures should be changed to a switch case and I'm not sure what you're doing with them: Why aren't you just stating 'socketOne= 1' and 'socketOne = 0', or the more proper 'socketOne = HIGH/LOW'. As a side note 's1 = s1 + sO' can just be writen 's1+=sO'. Thirdly, don't have digitalWrites every loop; only write when they change (this is something I bring up almost constantly and should probably be bolded in the OP). Stick them in the on/off state handlers.

Edit: I see why you did it; multiple keys can trigger the same event. Fixed.

Thank you.

Acid Reflux
Oct 18, 2004

ejstheman posted:

A 16MHz crystal is cheap per each, but I assume not if I only need two of them, what with S&H.

Where do you live? I have a whole shitload of 16MHz crystals on hand for Arduin-ish projects, and I'd be more than happy to throw a few in an envelope and send them along. I'm in the US, so postage to...well, basically anywhere...is going to be negligible, as long as you don't want them tomorrow. :)

ejstheman
Feb 11, 2004

Acid Reflux posted:

Where do you live? I have a whole shitload of 16MHz crystals on hand for Arduin-ish projects, and I'd be more than happy to throw a few in an envelope and send them along. I'm in the US, so postage to...well, basically anywhere...is going to be negligible, as long as you don't want them tomorrow. :)

I got my hopes up that I could desolder the crystals from the broken boards and pop them in the breadboard, but it turns out the leads are too short. Womp womp. I recently got a super-great job, though, so I would feel bad accepting charity. I can buy some crystals. I need some power regulators and capacitors and whatnot too, and I'm thinking of getting one of those ICs with four Schmitt triggers in it because this debounce code I'm working on is really annoying. I can get a decent order together and not worry too much about shipping. Thank you for offering!

Acid Reflux
Oct 18, 2004

Sure thing! I know how frustrating it is, so I figured I'd throw it out there. :)

Acid Reflux
Oct 18, 2004

One ridiculously messy prototype later, I've got an ESP-12 board (flashed with the NodeMCU firmware), running standalone, that reliably triggers a relay via my home wifi. Right now the relay just controls the little LED that's circled, but as soon as I get a little better at this NodeMCU/LUA stuff, I'm going to make a nice lazy man's switch so I can turn something useful on and off without getting out of my chair.

Truly, the future of home automation is now, if still a bit klunky.

Hadlock
Nov 9, 2004

New "arduino compatible" ESP8266-esque device for $13 on kickstarter, programs over wifi instead of USB, "The Oak"... It's about the size of a half dollar.

https://www.kickstarter.com/projects/digistump/oak-by-digistump-wi-fi-for-all-things-arduino-comp/description

Adbot
ADBOT LOVES YOU

Jamsta
Dec 16, 2006

Oh you want some too? Fuck you!

Acid Reflux posted:

One ridiculously messy prototype later, I've got an ESP-12 board (flashed with the NodeMCU firmware), running standalone, that reliably triggers a relay via my home wifi. Right now the relay just controls the little LED that's circled, but as soon as I get a little better at this NodeMCU/LUA stuff, I'm going to make a nice lazy man's switch so I can turn something useful on and off without getting out of my chair.

Truly, the future of home automation is now, if still a bit klunky.



'sup NodeMCU buddy.

I've been doing the same thing this weekend but using N channel mosfets to do the switching of high loads - in this case a 7.5w led cob strip.



Hadlock posted:

New "arduino compatible" ESP8266-esque device for $13 on kickstarter, programs over wifi instead of USB, "The Oak"... It's about the size of a half dollar.

https://www.kickstarter.com/projects/digistump/oak-by-digistump-wi-fi-for-all-things-arduino-comp/description

That's really neat, lots of modules and better support than some no-name ESP board.

Not too much more expensive, but still enough more for me to be put off.

The two part "killer app" part of the ESP is features and price.

Jamsta fucked around with this message at 12:15 on Apr 27, 2015

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