Jump to content

Ned

Members
  • Posts

    8471
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Ned

  1. theres a video chip you can still get from china. Max7456 or something like that. It's on all quadcopter OSDs... so you could buy a minimOSD for $10 and reprogram that to do what you want is you really want a composite video signal for a big screen? or just build/buy a large 7 seg display?
  2. dude, i've been doing this every day for over 10 years and my code is still a giant tangled mess haha even if you plan, it always changes... or you just want to quickly add something to test something which often stays like that forever haha.
  3. ok, few things then Keep in mind i dont really do 'arduino' as such, so not 100% sure how this works, but im gonna assume its pretty similar to 'real world' C coding first, serial stuff, the best way is to add a checksum to the data. To do that, you basically need a way to say "this is a new bunch of data", "here comes the checksum" and "this is the end" and then the code knows when it starts and ends and where to find the checksum. The easiest way to do this (in my opinion) is to use the way GPS NMEA strings do it. They start with a '$', place the checksum after '*' and end with '\r\n' (carriage return and line feed, or simply 'enter') So that means you cant sendthose things as data in the string, but how often do you need to send $ and * right? I like that way as it means your data is totally still readable in a serial console, and you can find online details and calculators to check that your checksum is right. Plus the checksum is a simple XOR of the data i believe, so super easy and fast for the micro... Not 100% reliable, as 2 bits of error could cancel out, as well as some data missing isnt picked up necessarily (ask me how i know) so there is better again, but gets harder. The NMEA one is pretty good most the time though! you can make it better by a) sending small packets, and b) adding a length to it so you know you got everything correctly. It's now no longer a 'standard' method, so calculators no longer work, but will make the code better and still readable A better way is going full big dick swinging binary... so no more human readable data, which is a cunt when you're tyring to debug (but good coders dont need to debug right? as all their shit works first time? ) so you basically need the same way of being able to say "Start" and "End", but you now use binary data (0-255) so you need to pick a number. Standard number is 0x02 for start, and 0x03 for end. But that means you cant send those 2 bytes as data anymore, because the code will think you are starting or ending a packet instead of sending data. Follow? So they use an escape character... 0x10 is standard here again. So what you do is, when you receive 0x10, you just assume that whatever comes next is data, not a command for start or stop or anything. so say you want to send start, 0x01, 0x02, 0x03, End, you send 0x02, 0x01, 0x10, 0x02, 0x10, 0x03, 0x03. Follow still? same goes for sending 0x10, you send 0x10, 0x10. you also want to add a length and CRC to it. So you just make a packet where the first byte after the start is the length, and the last byte before end is the crc. This way you get pretty reliable data through the other end. Granted, if you go and send giant packets, the chances of fucking it up are still quite high... so send 'small' packets. While we're at it, you now also need to tell the code what the data means. I use a command byte for this (or command word if you have lots of shit to send) so my packets look like this [STX] [CMD] [LEN] ...[DATA]... [CRC] [ETX] where STX is start of transmission, CMD is command, LEN is length, Data is a variable length amount of data, CRC is a checksum byte of everything from CMD, LEN and DATA xored together and ETX is end of transmission. Then command usually has a 'set' and a 'get' which i usually assign to the top bit (0x80 for byte and 0x80000 for word) so then i can have a list of commands (in an enum usually) that the code can then use. So e.g. enum commands { CMD_MIN = 1, CMD_MAX, CMD_AVG, CMD_SET = 0x80}; Then you can send CMD_MIN if you want to know what your min value is, opr you can send CMD_MIN | CMD_SET to signal you want top set the min value. I have no idea if you followed all of this... it's a lot of fucking around! and i suck at complaining, especially when i cant post actual code for you to follow haha. So i hope that showed you something at least? maybe? Now, next, Libraries, libraries are great for stand alone things, but you can also tidy up things that arent stand alone. Regardless, libraries still need to work with outside world stuff, they likely never function within themselves and require either inputs or outputs of some description right? actually, fuck it, i wrote a bunch of shit that was impossible to follow, and heres a google result haha. It explains is quite well https://www.arduino.cc/en/Hacking/LibraryTutorial So, now, sharing data say you have a struct or array called data, which has a max, min and avg in it... and you have that in data.c or something. Now you want to change min from usart.c because thats where you got the data from, and you want to read it from the main loop as well to see if you should turn an LED on or something. What you do is you tell the rest of the code you have a variable called data already by putting extern struct data; in the data.h file. Now in the rest of the code, if you include data.h, it tells that copde there is a variable called data and that they can use it if they want. So you can now do stuff like data.min = 10; in your usart.c code, or if (data.avg < 7) digitalWrite(1, HIGH); or whatever. I know that explains it badly, but i hope it gave you enough info to know what to search for on google to get better answers lol
  4. everyone uses those HC-05's and they work. They are shit, but they work Problem with serial is dealing with fuck ups and lost bytes or even just bits... which for a personal project is hardly a problem as it's not a big deal 99% of the time, but if you want to send data that sets up your project which then in turn controls your ECU, you wanna make sure it gets all the data correctly, or else something like "set timing to 38 deg" can turn into "set timing to 110 deg" by the serial timing just being SLIGHTLY off... and serial timing is always slightly off as everyone uses 115200 BAUD, which an arduino cant do with 100% accuracy (it gets plenty close enough as long as it has a crystal, which i think all arduinos have) but yeah, good idea, and do it! I can send you somne ideas on how to packetise data etc if arduino doesnt already have a decent example (which im guessing they probably do) also, roman, this guys is 100% you and you need to watch this!
  5. truthfully, i didnt come because it was raining, there was a cooked meal at my girlfriends house and the last few meets have been shit so had a huge case of the CBFs
  6. im posting here so i dont forget about it and will see what life brings
  7. same boat as @h4nd sorry. Looks like fun, but risky fun haha. Get a rental and try it on that first?
  8. that seat looks REAL comfortable for endurance rides
  9. im out sorry guys, i need to save my holidays and money for other shit, sorry
  10. should we remind that @Snoozin character?
  11. have you seen how many bullshit projects i have on the go that i need to throw neds at? It's still an option, we'll see what happens haha
  12. pretty sure he did negative work haha its less complete than when it left yours from the 17 seconds i've looked at it
  13. we can has a look for sure
  14. Cheers man! Hey @johnnyfive you have a spare CT110 for an unprepared latecomer?
  15. So, i kinda really wanna go on this, and i have a project scooter i could work on, but i dont think its gonna cut it even if i do get it running (photos stolen from MopedNZs build thread, as i own that now but dont have any of my own photos) So, i was kinda hoping there might be a spare bike going somewhere? Or maybe one that just needs a touch of love in Auckland? Im happy to get my hands dirty for a few nights or something... i just dont wanna buy yet another bike/project... Anything spare floating about i could hoon around on? or should i just offer my services as a support vehicle driver for a few days so i can still be (kinda) part of the fun?
  16. accidentally went yesterday with @sentra and @manlymanman... guess we're going two days in a row then... oh well Hey @Snoozin, you should come too!
  17. I'll be there Hope we get a turnout like a couple months ago!!! that one was great!
  18. you know everyone else will be there on Wednesday, right?
  19. hey roman, instead of fancy opto isolators, you can just use a couple resistors... or can go a bit fancier with a couple resistors, a diode and maybe a cap if you wanna be really sure its fine. Might save some space and cost in the end?
  20. ive been there every day, just in case you fellas show up again!
  21. I got enough time to swap a gearbox right?
  22. Bar graphs are pretty low intensity for embedded systems as well... Just an idea
×
×
  • Create New...