tonton81akk: hi
tonton81i was able to get it working using strtoul
tonton815 lines of code :P
akktonton81: Get the atmega368 to work with strtool?
tonton81i like the 3rd option
tonton81looks clean ;)
akkGlad it's working, but I think maybe you meant to highlight someone else. But I have to go, can't stay to figure out what it does ...
tonton81[13:25] <akk> tonton81: FWIW, sscanf(str, "%u.%u.%u.%u:%d", &ip[0], &ip[1], &ip[2], &ip[3], &port); worked for me in a plain C program. [13:25] <akk> tonton81: Note the &port
tonton81you and siberia :)
tonton81sscanf didnt work for me
akkah. Yes, I always use something else rather than scanf, personally.
akkI figured it if was on that topic it would be to tonton81, not to me.
akkAnyway, really going now. :)
tonton81ok :)
d3jakeSnert_: Be ye awake?
FireHopperhiya d3jake
d3jakeFireHopper: Hi. How're ya?
FireHoppernot bad, got early xmas stuffs :) so yeah
zethhi, is anyone here?
zethcan someone make a sketch or code for me?im not good with arduino
carl0s-Why does: char data[]={0xFF} ; strlen(data), give me 2 intsead of one ? it seems oK with larger arrays
klinecarl0s-, strlen() looks for a terminating '\0' char
klineif you don't have one in your array, it could be right by accident because the next byte in memory is zero, it could be hundreds, or it may run on to the end of memory and trigger invalid memory accesses and cause Very Bad Things
carl0s-kline, Yeah I did hear that, but how does that make a difference here? It correctly give 3 for char request[]={0x81, 0x22, 0x05};
klineits most likely right by accident
carl0s-maybe I need to initialise the array properly to nulls
klinefor arrays, you should just track the size, or use a specific terminator
klineid recommend not using strlen generally, as by design its specifically implemented for strings
carl0s-I know but I kind of need it I think
klinethis means it may give you poor results in other cases (say, an array of ints, it would be approx double the size)
carl0s-I'm passing an array of hex bytes that could vary in length
klinewhy do you think that?
klineok, then pass the length at the same time
klinesomeone, somewhere, knows the correct length, as they created the array
carl0s-i was trying to avoid having to do that because it seems a bit crap to have to do that..
klineperhaps an example of what you're doing would be useful
carl0s-see the call to function at bottom
carl0s-I know adding in the length will work but it would be nice if the program was able to deduce the size of the array that was passed to the function and just deal with it
klinefwiw, here's an example of forcing the memory to demonstrate why this is unsafe:
klinecarl0s-, right, at the time you know that request is three elements long though
klinelikewise kwpPacket has elements demonstrating length
carl0s-yeah but I don't want to have to put ",3" in as a parameter though..
klinewhy not?
klineim sorry, this probably sounds frustrating, but basically you're saying "i dont want to do the correct thing"
carl0s-seems a bit crap that a computer program can't work that out
klinesome languages do, but not C
carl0s-the information is there though so it should be possible to program it so that the human doesn't have to input extra information that is kind of already there
carl0s-ok :)
klinethe way C works, the program may not actually know at the time
carl0s-this is because the compiler has to size everything up in advance?
klinewell, if the compiler knows the size in advance, you ~can~ use the sizeof
klinebut all you're doing is adding a longcut to the hardcoded value (but its important to understand why the hardcoded value is used, and the limitations of the sizeof op)
carl0s-I'm sure that was giving me address /pointer sizes before.. i.e. 4 for everything
klineyes, it generally gives the size of the type
klinefor arrays, you can get the length of the array in bytes, and then you can divide by the size of the elements in the array
carl0s-ah I have read about that being done.. didn't quite get it but it makes sense
klinebut arrays decay into pointers depending on how you use them, which is why you cant pass an array into a function and use sizeof, you must do so beforehand
klinelet me write it up
carl0s-a so I do the size of on data[] before passing it, and then pass it
carl0s-like, char request[]={0x81, 0x22, 0x05}; SendKWPPacket(request,sizeof(request));
klinesee how we can use sizeof when the original declaration of myArray is in-scope (in main), but after it's passed to a function, it decays into a pointer and the best we can do is get the size of a pointer
klinebut ultimately, all we've done here is add a decent way to not-hard-code the value at the call site - but the value is still hardcoded above at the declaration time
carl0s-yes I get it. although i'm still not 100% on the dividing by the type. does sizeof always return bytes or something? My array is an array of chars which are bytes, so I can leave that bit off ? It seems to work anyway,
klinethe size of the array is the size of the array, not the number of elements in it
klineso the size of 10 ints, where ints are 4 bytes, is 40
carl0s-kline, yes but it means I have a user-friendly function that only needs the actual request putting into it
klineif we know its 40 long, and each element is 4, we can divide to get 10 elements, which is correct
klineso the short answer is "no", you should still divide by the size of the type
carl0s-ok :)
klinei agree, it's clunky, but it's just inherent to how C works, so there's not really a lot we can do about it
klineonce you pass an array to a function, it's decayed down to a pointer so we cant get any info on its length, even if we can still access it with array syntax
klineso we must track the length and pass that along, which is some cases is easy (if the size is known at compile time, we can use sizeof hacks, but if the size varies at runtime, we must either constantly track growth/shrinkage or use a terminator element of some kind)
carl0s-I understand. i'm happy with because it means all that needs entering is the request[]="" part. and the program does the rest :)
carl0s-yeah I thought I might have to use a terminator and iterate etc.
carl0s-thanks :-)
klinenp, sorry it was a bit meander-y and probably a little frustrating at the start
kaoshavocok, if my dog typed anything while I was gone, sorry
kaoshavoche did make all the font on my computer to the smallest possible
carl0s-no it was helpful!
kaoshavocakk must have left, I got the bootloader burned so I thought I would let him know
carl0s-here's a non-C but more arduino question.. When I was iterating over an array of hex bytes and usng Serial.write(array[i]), my stuff was being recognised and responded to nicely. Now that I am storing stuff in uint8_t types inside a struct, and sending the data out with Serial.write, it doesn't seem to be working. Do you think it's possible Serial.write is turning F1 into ascii instead of hex? and 0x05 into ascii 5 or something (that'd be the sa
carl0s-me though right?)
carl0s-hmm nah it can't be turing an int into a string..
carl0s-ah bugger. i wasn't initialising my struct values.. so I was reading in random memory data.
carl0s-so I can't set default values in a struct for just some parts, and not others. I can't set the ints to 0, and then populate / initialise the array part of it later :-/
carl0s-right, since changing my char data[255] in the struct, to char *data, well, yes that lets me pass data as a parameter to a function, but now I can't do a "Serial.readbytes(data,length)" any more :(
carl0s-the thing just freezes up
DrzacekI think I killed my pro micro
DrzacekIs there any reason it would not start (or be recognized in windows) beside being fried?
zap0windows drivers are shit (not a hater, just stating technical fact).. reboot it.. see if that helps
Drzacekzap0, tried on few machines, also on linux
Drzacekwas working fine earlier
zap0that's some good testing then. sounds like it's tried
Drzacek2months waiting, 2 day fun :D
malinuszap0: should have hit him with the good old windows admin trick. "Just reinstall windows and see if it fixes the problem"
alphaferrethas anyone used the keystone 793/794 9v battery contacts mounted to a pcb. wondering if they sit at the right height and or removing battery puts stress on the board joints
flor1angood morning
flor1another than DHT11, which sensor would i want to use for relative humitidy?
gruglyI have a DHT22 hanging out with my chickens, but it's acuracy isn't awesome.. there was another I kept reading about in the forums and whatnot while I was working out what to do with it.. I don;t remember their modle number
flor1anaccuracy isnt really the issue, i'm totally fine with +-5
grugly+-2 on the DHT22, I believe..
flor1anoh that sounds super fine
flor1analright, one more on the list, thanks grugly
flor1anwhat about the HIH 4030?
flor1anpreferrably not from sparkfun because quite honestly 17usd for such a breakout is a bit nuts
flor1an(it is 35eur on german amazon, even more, lol)
flor1anis the hih4030 any good?
gruglythe dht22 I'm using was under 10AU
flor1anyea, i can find the dht22 for around 5eur
flor1anthats cool
gruglythat could be the other one I was reading about. I'd like to try one.. I believe they are more acurate
flor1ani wonder why i can buy fridge thermometers with the exact package onboard (and a small lcd) for less than the sensor itself
flor1an(i tried salvaging components. doesnt work.)
gruglymaybe you're just doing it wrong?
flor1anthen the error must be specific to this board
flor1anas it is more or less the first try of salvaging that failed (2 times in a row)
flor1an(the error i am committing, what ever it may be, i thought i could solder)
flor1anfunny enough i can salvage the temp sensor of it, which i would assume dies first when soldering iron is near
flor1anbut not the rh
flor1angrugly: one more i found was the bme280, do you know about it?
gruglyI only have experience with the DHT22.. I'm pretty new to all this, really..
flor1anso am i
flor1antrying to build a kind of a hydroponics monitoring thingy
flor1anwhich is, quite frankly, super mad fun <3
gruglythat's on my list, too...
gruglyI have a greenhouse frame half built and plastic sitting in the shed..
gruglyneed to get garden besds and fish tanks..
flor1anoh that would be aquaponics wouldn't it
gruglypracticing on my baby chickens until I get there :)
flor1annah, i'm just pumping water in circles
flor1anfor a start
flor1anaquaponics is (for me) level... 5+ while i am at <1 :D
flor1anwe have a dog, but i know jack about fish, even if everybody says 'with the right fish it is a breeze'
flor1anit is living creatures in the end, still
gruglyI've had a 800lt fish tank with 200lt of garden beds at my last house..
flor1anand i'm slowly starting to wonder where in my house to put the tank
gruglyI want to step it up here, a few k lt fish tanks and a full greenhouse of gardens..
gruglyI had a bunch of great ideas.. not all of them worked..
gruglymy fish were goldfish, which I still need to go pick up and put in a tank somewhere here..
gruglyI want some edible fish here..
gruglyI always liked the idea of a fish tank in my lounge room with led grow lights and NFT tubes hanging from my roof..
DrzacekGood news everyone
Drzacekmy arduino is alive!
Drzacekturned out there was some short circuit between RAW and GND. After solderng it out, came back to life
IcePicyay, one saved soul more
pwillardIts always something like that which needs to be checked before giving up
raphaflor1an: keeping fish is not difficult at all if you don't get either impatient (and change things too much, too quickly) or arrogant (and try to keep "special needs" fish)
raphaflor1an: also, german amazon is tremendously expensive when it comes to electronics parts. don't go there. ebay is usually fine, or if that's still too expensive, aliexpress.
deskwizardand get cleaner fish they work wonders, look prehistoric
raphawhat are "cleaner fish"?
raphai _hope_ you're not referring to members from Otocinclus or Macrotocinclus deskwizard?
rapha(because those are _not_ fish for beginners, even though they're being sold as such in near every store)
deskwizardrapha: no damn clue, looks prehistoric, eats crap
deskwizardkinda angular face
raphadeskwizard: pics?
deskwizardnone atm, maybe later, but I doubt thats the one you meant, they definitely not high maintenance
deskwizardguppies tetras and rasboras are pretty cool
raphadeskwizard: ?
raphaguppies of all kinds are awesome beginner fish, i'd just recommend to only get males if flor1an doesn't intend to breed. population can outgrow a tank's capacities quickly otherwise.
deskwizardrapha: lmfao tell me about it, my uncle had 100s lol
deskwizardthe females have sperm for like a year
raphadeskwizard: what are "officially" called "cleaner fish" in English are salt water fish only:
raphalol yeah they do keep that sperm around for a long long time
deskwizardOh okay, i didn't know that, i just call them that :P
raphaand don't be fooled by them still being small. the fun starts early for them.
deskwizardvery early yes hehehe
raphatetras i'd again advise not to give to beginners as they tend to either change things around too quickly or too much or have troubles keeping a tank's conditions stable
raphathat's the reason why tetra populations keep diminishing and people keep replenishing them
raphawhereas the guppies will be *shrug wtf* and "dude i don't care what water i swim in so long as it's properties include 'wet'" (captive-bred guppies anyways)
deskwizardthat bad? hell my uncle throws fish from the river in there lol
raphai've just recently started keeping Boraras maculatus which seem to be more hardy than their size would suggest. "Real" rasboras should be even hardier, but probably not as much as guppies.
deskwizardwe went clam hunting for fish food lol
raphawhere do you guys live and what is the temperature of your riverS?
deskwizardrapha: Canada, it was in the summer. They don't like it though...
deskwizardI got him rasboras for his birthday, orange with the black triangle, like em
raphaalso note that if your uncle has a big tank (200l upwards) that size water body can process some sick shit
deskwizardrapha: and those two prehistoric monsters could probably have a tank each they grew so fast :P
raphayou likely got your uncle Trigonostigma heteromorpha ... it seems in English you call them Harlequin rasbora. I've never much cared for them but heard good things about them being quite adaptable.
raphadeskwizard: this your prehistoric monster?
deskwizardrapha: not quite, but similar body shape
deskwizardless the messed up head lol
deskwizardrapha: Ah, probably, I barely know anything about fish, and translating fish names aint my strong suit :P but yeat I think they are
raphadeskwizard: then, Pterygoplichthys gibbiceps
raphayou can't really translate fish names anyways. well, you can, as the proper names are just regular latin. but the common names often have nothing to do at all with the scientific names.
deskwizardnot quite either, head his more flat and angles than roundish like that, I'll grab a pic
deskwizardrapha: indeed hehe
raphathese cat fish of that rough category are really popular and some of the species can grow to insane sizes
deskwizardrapha: thats probably the ones, they're fkin big
raphaapart from that they can handle quite a range of water conditions
raphamy first-ever fish was such a one
raphaall the other kids wanted a bunny
raphai wanted a fucking fish
raphaand it was like 3cm in length when i got it
raphathat was in 1992
raphathe fish is still alive
raphameasuring almost 40cm in length now
deskwizardwow :) awesome
deskwizardwe put a ... fk what are they called... they look like small lobsters...
deskwizardwe put it in end of summer, was like 2cm long
raphait (and i) was very lucky that my care keeper took it over when i left the children's home at 16 and that she had a 200cm-length tank
deskwizardhad to take it out last week, killed a brand new fish, its about 10cm now
raphahmm crawdads like to do that
deskwizardyes, that
p0g0crawdad, past tense
deskwizardit was fun at first seeing it eat the clam and all but yeah, it got out of hand lol
raphadeskwizard: it could also be a freshwater shrimp, possibly of genus Macrobrachium. they are quite badass, but imo not as badass as crawdads.
deskwizardit was doing population control for the guppies hehe
raphadeskwizard: also, catfish (as your "prehistoric monsters") are not _that_ old evolutionary speaking. wanna see a prehistoric monster? enter the butterfly fish: (i tried keeping a pair, but the guy drove his wife-to-be into death, so i thought i could at least get a pick of the chops)
raphathese guys have been around for around 85 million years and haven't changed a single bit during all that time
p0g0the gar or the horseshoe crab are really ancient I think
raphap0g0: okay but then those are hardly fish
p0g0the gar is a fish
raphaya deskwizard that's a crawdad
raphaoh i only read horsehoe crab
raphaah, flösselaal in german
raphayes, those are even older than my beloved Butterfly Fish
p0g0They both get mentioned in genetics classes as examples of really really old advanced life forms
raphabut need lots of space if you want to keep them
raphaas in, i wouldn't
p0g0yeah, wasn't thinking about raising them, but I think they are in the river that forms the boundary of this property, not sure tho, I've not fished the river.
raphaalso i'm keeping Pantodon buchholzi because of something even the Gar can't compete with: its brain has three (!) different processing centers per eye: (1) the water below (2) the reflection above, from the water surface and (3) anything outside the water.
deskwizard:| woah
raphadeskwizard: want another pic? :-)
p0g0sounds a bit like a horse, two halves of the brain with almost no connection between them
raphaapparently not so: the three processing centers get combined in the end to form a single picture of all three areas
raphai've been meaning to read my way through the various neurebiology papers on the subject, if they just weren't so damn difficult to understand
p0g0insect eyes do that, with a zillion facets
p0g0hey, the 'other bugs'
p0g0since we are in a computer coding channel...
raphadon't ask me to implant an ATtiny into the butterfly fish!
pwillardRapha... you just need to date TV's Blossom... she should explain it to you.
pwillardapparently Mayim Bialik knows that stuff
raphapwillard: Mayim Bialik you mean? A bit out of my date range :-P
raphawait she's a neuroscientist portraying a neuroscientist
raphanow that's cool
raphaluckily i have my own neuroscientist buddy
raphareally should go to cambridge again sometime next year
carl0s-hey.. it's me again. Mr trying-to-learn-C++ by trial and error and google, and struggling.. can anybody advise on this? explaination in the comment at the top :
pwillardFYI: on sale now...
carl0s-(i've cut out a lot of code there.. it's just the data[] / *data stuff that's an issue. I need to pass as a parameter, initialise with values, but also be able to read serial into it
klinelet me have a look again
carl0s-pwillard, i've subscribed to laracasts, got Python books, was trying to learn SDR stuff with gnuradio, trying to fathom out IDA Pro, winols, bosch ems system, and I have a day job and a girlfriend. I need a few more lifetimes. I was thinking about a book on C++ but i'm not sure if it'd just not be a bit intense
carl0s-thanks :)
raphapwillard: also still a very good and useful book is the original "The C Programming Language" by Kernighan and Ritchie.
zap0carl0s-, do you know what sizeof() is
klinezap0, lol
carl0s-i'm using it there for the array length bit
raphawoaaah nice
klinecarl0s-, just dumping data opaquely into an array when really it's structured is just a pain in the ass
klineit means you end up having to duplicate parsing code all over the place
raphacarl0s-: go read that, your code seems to be imperative anyways
klineits better to localise it all into one place, take in a stream of data, and deserialise it into a well formed struct
pwillardThat was what I was implying yesterday...
carl0s-I suppose 288 pages isn't so bad
raphacarl0s-: also it's the book written by the guys who invented the language
carl0s-yeah I know that bit :)
raphaand surprisingly not didactically bad _at_all_ with some nice examples etc
carl0s-i've been spending most of my time trying to understand the kwp2000 protocol spec so far
carl0s-my code is working now, but it just seemed like the struct kwpPacket should represent a kwpPacket. but it doesnt if I have to have an unused char *data for when it's being used by a receive packet function, and an unused char data[255] when it's being used for a send packet function.
pwillardYou will only find basic examples... it predates many "standardization" attempts. (aka meddling)
thiagofacchiniHello Guys!
thiagofacchiniHow you guys doing?
deskwizardo/ ²
thiagofacchiniI think I need your help ...
thiagofacchiniI went rogue these last 3-4 days with BOMOS
zap0thiagofacchin did you just assume my gender
thiagofacchiniBut I'm facing a potential issue which I don't have experience to handle, so I thought... hey... Arduino group ;)
deskwizardas long as you eventually describe it we might be able to help :P
thiagofacchiniOhh yeah, that's a very good point
thiagofacchiniSo, I got an Arduino, and a raspberry pi connected through the pi serial gpio
thiagofacchiniThe pi is using a test program that I wrote in node, that basically sends a message over the serial port
thiagofacchiniThe Arduino also with a test sketch that writes on the serial, some random crap
thiagofacchiniThe goal was: Arduino to acknowledge the received message as well as the Pi
thiagofacchiniWell, when I run the node "program" on the pi ... guess what...
thiagofacchiniNothing happens
pwillardthere is a lot of missing detail there
thiagofacchiniI'm using a bi-directional logic level converter
thiagofacchiniLooks like it's properly connect
thiagofacchiniJust ask me pwillard
thiagofacchiniFire away
pwillardummm... and you are not using the USB virtual serial... why?
deskwizardthiagofacchini: first do a loopback test on both sides
IcePicACTION also recommends using the usb-serial if possible
deskwizardand make sure you deal with \n and \r if applicable
thiagofacchiniok... pillared, because I want to use the serial gpis? ;)
pwillardewwww yuck
deskwizardpwillard: IcePic any particular reason why?
pwillardhorrible idea
deskwizardI'm curious
thiagofacchiniSo am I
IcePicdeskwizard: because its so darn easy to move between laptop and rpi while developing the protocol
IcePicjust the fact that a level shifter had to come in makes it more complex right there
thiagofacchiniOk, so let me describe my current environment
thiagofacchiniI got the Arduino connected to my computer
pwillard1) because it's for console messages 2) its not at the right logic levels 3) its often repurposed to drive the Bluetooth on newer Pi's etc... USB gives you a simple /dev/ttyACM0 device... bang done... no issues.
thiagofacchiniAlso got the pi been powered through the USB
deskwizardIcePic: I agree with the level shifter part, but I would just run the arduino at 3.3v :P
pwillardtalk to the arduino via your PI
thiagofacchiniI'm ssh ing... on my pi
deskwizardpwillard: didn't think about 3, very true
thiagofacchiniAnd watching the serial monitor of the Arduino on my computer
thiagofacchiniRegarding reason 3 pwillard... it's already disabled
pwillardbut... you can do the exact same watching via your PI
thiagofacchiniI can't watch my Arduino serial....
IcePicof course you can
IcePicrpi is a normal unix computer
thiagofacchiniI'm noob
IcePicinstall any program that talks serial. cu, minicom, screen, kermit ...
thiagofacchiniNot referring to the pi os ;)
pwillardthe IDE is not required for serial troubleshooting
thiagofacchiniI got thing working before....
thiagofacchiniThis thing*
thiagofacchiniI don't even know where to start the debug proccess
thiagofacchiniAhh... I got a weird one for you guys
IcePicif it did work and now doesn't, chances are large the connection is faulty
IcePicdo the loopback tests deskwizard recommended
raphathiagofacchini: why don't you debug your Arduino via Serial and have the Arduino and the Pi talk to each other via USB?
thiagofacchiniNo specific reason rapha
thiagofacchiniThat may be a clue, I'll leave for you guys to decide...
pwillardI always write quick python code to trigger my arduino and collect what it sends back (with python) and stuff messages in a file using python logger
klinethiagofacchini, are you looping #raspberrypi into this as well?
thiagofacchiniLet me describe something I found interesting
thiagofacchiniSo when my Arduino is "solo" ( not connected to the pi at all )
thiagofacchiniI send a message through serial monitor
thiagofacchiniAnd it answer as expected
thiagofacchiniIf I connect the RX/TX on the logic converter.... Then it stops
pwillardbasically... we are saying... you can get your current method to work... but it can be so much simpler
IcePicthiagofacchini: you do know the usb2serial used when talking to your computer is still on the arduino even if you connect stuff on Rx/Tx pins?
pwillardthen you are doing it wrong
thiagofacchiniNo I don't IcePic...
thiagofacchiniSo I should disconnect from the computer? But then how am I going to power my Arduino?
pwillardand of course you connect TX to RX not TX to TX right?
IcePicjust because you pull out the usb cable doesn't stop the arduino usb2serial from also being on rx/tx pins
thiagofacchiniI didn't get guys
thiagofacchiniActually I'm confused now
pwillardthe pins 0 and 1 could STILL connect to the Pi if you insist while it is still connected to PC... but more importantly... why are not you using Arduino IDE on your Pi?
thiagofacchiniBecause the PI distro I installed has no gui
thiagofacchiniIs purely for node
carl0s-so before I read those 288 pages... anyone got a simple tip for this conundruM? : I can't use serial.readBytes into a char *data. I presume that's because the compiler doesn't know what size to allocate at the location for *data. but then if I use data[255] in my struct instead, I can't pass data to this via another function and use it inthe initiator of the struct.
pwillardOk fair enough...
IcePiccarl0s-: I'm not sure of the assumption in the middle
carl0s-before I went to sleep at 5am this morning, I was looking at stuff like &data = *pointer (or vice versa)..
thiagofacchiniThe thing I described... is weird at least isn't it?
carl0s-IcePic, it doesn't allow it. says it has to be a char buffer, not a char*
pwillardCarlos... my advice is to stop using Serial.readbytes() as it is a class function that hides a lot of crap behind a curtain... like an annoying default time out.
IcePiccarl0s-: could you quote error messages from the compiler? It's hard remote to parse the "it didnt, it will not, it does this"
carl0s-pwillard, Ok, get that. and I have been using my own loop for other bits, especialyl where I want to time the event, and catch the -1 etc.
pwillardthiagofacchini: we won't know how weird... we have no idea how you really have it connected.
carl0s-e.g. I do have this in my code elsewhere:
raphacarl0s-: note that the 288 pages were also intended more as a fix to your problem of wanting to learn C/C++ ;)
thiagofacchiniOk pwillard... here's how it's connected
pwillardcarl0s-: that is just my personal bias showing. I hate the builtin string/stream helpers
carl0s-IcePic, one sec.. let me try to serial.readBytes to try to go to char *data
thiagofacchiniArduino TX on Logical Converter RX
IcePicmy guess is that thiagofacchini had 3 devices on the same serial, the PC with IDE and serial monitor, the 328 RX/TX and the RPI gpio serial.
raphathiagofacchini: btw is it a requirement of yours to use node? or did that just happen?
thiagofacchiniThat's what I thought
thiagofacchiniNode is my playground rapha
pwillardSee. I assumed you were using software serial
thiagofacchiniSo should I power my Arduino through external power source? Like a battery instead?
raphajust saying, the Arduino IDE makes for an awesome playground, too, and makes lots of things easier
pwillardTechnically, you can't share serial pins of a point to point connection with a 3rd party unless you only LISTEN.
IcePicthiagofacchini: guess what, if you use usb serial, the rpi can power the arduino, at least if it doesnt draw crazy amounts of power
thiagofacchiniIcepic it will have servos connected....
thiagofacchiniI'll try power my Arduino through battery ... brb
pwillardthat has nothing to do with the serial issue
carl0s-I don't get it. it's compiling with serial.readBytes( now.. (when is of type char*). This definitley wasn't working last night :-/ maybe i'm mis-remembering the issue
thiagofacchinipwillard doesn't?
pwillardcarl0s-: you can also write a proper parser that is suited to your specific need without too much effort
thiagofacchiniI'm using the Arduino usb connected to my computer to power the Arduino
thiagofacchiniAnd trying to watch what the PI is sending through serial monitor
pwillardand all the servo's?
IcePiccarl0s-: C (and C++ I guess) doesnt make much of a difference between char arrays, strings and buffers[], its all a single pointer when being passed to a function
thiagofacchinithe servos are not connected now
thiagofacchiniI want to test the comms before hook all the crap on
carl0s-how does it know how much space to reserve for an incoming data stream with I just declare it as char *data; ?
pwillard<sigh> you would be so much happier just using the Virtual com port by plugging into your pi.
pwillardand you power it that way too
pwillardThough you might need a usb hub
IcePiccarl0s-: you already set it up as [256] once, and reuse for send and receive.
thiagofacchiniSee I want it to be as compact as possible
IcePiccarl0s-: it doesn't reserve, it blindly reads as much as you say it is allowed to read with the length parameter
IcePiccarl0s-: might help a bit
pwillardMore reason to not use a level converter and use the USB serial on the pi
thiagofacchiniThe level converter is super tiny
carl0s-IcePic, I've no longer declared it as [255].. my complete code looks like this now, which is sort of how I thought it should look, but I couldn't get it going last night. between passing the array to the function which in turn passed it to the initiator of the struct within the function, and also using the same struct type for receiving data, i just couldn't find a way to make it work all ways for the array part data[]
carl0s-quite a lot to look at but complete code, with some bits temporarily disabled,
thiagofacchiniPowered Arduino through battery, apparently it's not working
thiagofacchiniThe TX/RX on Arduino don't even blink....
pwillardIcePic: yes, that forum post explains my dislike for these routines somewhat
IcePicpwillard: it also discusses various choices you can make
IcePiccarl0s-: 10400, odd. ;)
carl0s-well.. it compiles.. I guess I can try it again when I get home :)
carl0s-yeah that's K-Line
pwillardthiagofacchini: you need software serial in there somewhere
pwillardyou can't share the serial lines
thiagofacchiniLike what? minicom?
pwillardNo... in the arduino code... you need to assign 2 new pins for serial... and assign those new pins (tx2, rx2) to the softwareserial library and then use those pins with your level translator if you with to still use and troubleshoot with the IDE wjile you also send data to the node.js script on the differnt connection
laenGood morning loves.
thiagofacchiniIt's WORKING!!!!!
pwillardwhen you connect your level converter to pins 0 and 1 while USB is connected... you stomp on the point to point connection and it wont behave that way... don't do it
thiagofacchiniIt was working all the time...
thiagofacchiniWeird the the serial monitor doesn't output anything
thiagofacchiniGuess it can't right?
thiagofacchiniNot when I'm also connected to the PI
pwillardSimple serial connections are between 2 end points not 3... so take that out of your design
thiagofacchiniItI was trying to debug through the serial monitor
pwillardand we have been saying... debug using the Pi
thiagofacchiniyou were right
thiagofacchiniThere is 2 things
thiagofacchini1st - Not debug from serial monitor
thiagofacchini2nd - my node program isn't reading the serial port on the pi, just sending ;)
thiagofacchiniGeez, now I feel even more stupid
pwillarddo you recall that I said that a 3rd party on the line will KILL the signal?
thiagofacchiniI should stop with IT / Electronics and go back to the farm...
thiagofacchiniPigs are way easier to debug
thiagofacchiniYup I do....
thiagofacchiniSpot on
pwillardyou really have 2 options... 1) use software serial and 2 new pins for data to the pi or 2) move the USB connection of the arduino to the PI and ise the virtual com port for troubleshooting directly on the PI.
pwillardyou can even add the extra debugging code to your node.js app... and won't need the IDE for debugging
zap0arduino mega has 4 serial ports... so USB would only affect tx0/rx0
pwillardgeez... i didn't ask if it was a mega DOH
pwillardjust assumed UNO or Nano
thiagofacchiniI built the board
pwillardMy first arduino was also made at home.
zap0pw, nice!
thiagofacchiniThat looks so much better than mine
thiagofacchiniHow did you do? I mean through what process?
htafdresgiis there something I can use that can convert analog signal from a moisture sensor to something I can plug into a digital I/O pin?
zap0htafdresgi, lol.. yeah an arduino.
thiagofacchiniDid you iron the circuit?
IcePichtafdresgi: why not put it on an analog pin on an arduino?
pwillardand then... I explain it here... and here
htafdresgiI want to use the RISC-V or HiFive arduino, and it doesn't have analog pins
pwillardThat was actually the SECOND one I made... the first one is much less pretty
zap0htafdresgi, SPI ADC maybe
pwillardIt also shows that Arduino used to run on the atmega8 chips. (seriously limited ram)
IcePichtafdresgi: perhaps grab a sensor that doesn't report as an analog level?
IcePicshould be those aswell
thiagofacchiniHow did you do the board? Did you iron the circuit?
htafdresgizap0: like this?
pwillardhtafdresgi: you have explained exactly why you made a bad choice in getting the HiFive device... ;-P
carl0s-AH NO! I remember the problem now, I think!
htafdresgiI didn't get the HiFive device, it's just that I think it's the most ethical option, since it uses an open source ISA
pwillardthiagofacchini: I use a heat laminator
htafdresgiACTION is also a vegan
IcePicpwillard: yeah, those "lets put a crazy overpowered cpu on a arduino form-factor" projects sort of leave both camps disappointed
carl0s-struct packet { char *data}; serial.readBytes(,12);, caused a lockup! So I think that char *data did not have 12 bytes of space..
htafdresgiIcePic: well I was thinking if I put a small neuro-net in it, might be worth while.
IcePiccarl0s-: or the lifetime/scope ran out, or you sent the wrong kind of pointer
Yotsonhtafdresgi. Or an i2c ADC, or a 555 timer set up as a voltage to frequency converter. Maybe you could even setup 2 pins as a crude sigma-delta adc. Or like mentioned before, getting another sensor. :)
carl0s-which i why I ended up adding char receiveddata[255] for storing incoming serial data. but I had to use char *data for the function passing initiator business.
htafdresgiIcePic: I'm not sure where to get a digital moisture sensor
IcePiccarl0s-: just saying that foo[] might already be a pointer, so *foo might be a pointer-to-a-pointer to the stuff in {} and that would break of course.
pwillardHeck... I'm reasonably disappointed with the particle photon's attempt
pwillardat being arduino
htafdresgiI was looking at this moisture sensor:
carl0s-IcePic, the only other thing that i'm doing different is that when I'm storing single bytes, I am doing serial.readBytes(&,1); but when i'm storing a string of bytes, I am not using the & reference
carl0s-IcePic, hmm.
pwillardhtafdresgi: you know that is baically the equivalent of 2 galvanized nails, right?
IcePiccarl0s-: also, you seem to invent/create buffers a lot, you might just have one single [255] and reuse it everywhere, making sure you get function declarations right in your functions
IcePicin arduino code, its not too bad to make stuff global
pwillardcarl0s-: just read the bytes one at a time yourself... the code you are using does that anyway... just doesn't give you any control
htafdresgipwillard: didn't know, but good to know, thanks :-)
carl0s-ok but I think the problem is that I am reading them and storing them in char *data. doesn't data need to have some size reserved ? the incoming data size isn't known in advance.. or is this a job for an array size increaser thingy?
IcePiccarl0s-: you are sending the length in the calls
IcePicits your job to make sure the destination has space enough
htafdresgiOkay, so what do you think would be a good arduino board? I'm thinking I'll have 4 plants to read the moisture of, a ph sensor, a TDS sensor, and a water height sensor.
carl0s-I'm not on the getResponse stuff.. we don't know the length
pwillardI don't judge anyone harshly who uses globals in arduino code. It's just an embedded controller and the code is likely not going to bite you in the butt for have a global versus a scoped variable for some things.
carl0s-IcePic, I am only sending length on the sendPacket stuff..
htafdresgialso probably a couple buttons and an LCD screens
IcePiccarl0s-: Serial1.readBytes(&packet.length,1)
IcePicyou are saying 1 here, for instance
IcePicinside getresponse
carl0s-oh yeah. true. I do know how much I am asking for, because I get that in the Fmt byte (byte 1, lower 6 bits).
IcePicits just that you are not keeping track
IcePicbut that is just code-not-finished yet
carl0s-so how do I set the size of char *data which has been initialised alreadt ?
IcePicif you have made a 255 array, then size is 255
IcePicif you read one byte, you may read only 254
pwillardhtafdresgi: none of that screams "I must use a 320mhz risc processor"
IcePicI think its cool if htafdresgi wants to use the RiscV, its a neat project. Perhaps not for this, but in general
carl0s-but I haven't have I. I have made a char *data without any [] at all.. because when I was doing it as char data[255], I had trouble passing it through from the sendkwpacket function, into the struct initiator
pwillardI have a 10 sensor weather station that uses a lowly uno and it does just fine.
IcePiccarl0s-: no you haven't yet. You should
carl0s-IcePic, I can do that as well as the char *data ? it's not one or the other?
IcePiccarl0s-: you are talking out of your old misconceptions.
carl0s-no doubt
IcePicwe found out that those were not right, so don't assume C/C++ behaves only as expected from the old weren't-really-errors.
pwillardI can't even justify why I would need 320mhz risc processor as an arduino controller.
carl0s-so somehow here I need everything to be as it is, but for char *data to point to a buffer that is ~255 bytes long. do I create an array and link it to char *data like: char storage[255]; char *data = &storage; or something?
IcePicso make a reasonably sized buffer, make a few simple tests sending and receiving data using that buffer and the serial calls, and THEN start wrapping it in subfunctions that pass this along
pwillardMaybe if it came in a Mega format with a bajillion pins it could happily replace the mega in ,y 3d printer... but if my 3d printer is working fine on a 16mhz atmega... is that really a need?
IcePicyour issues come at least in part from what I guess is "tweak and add & * [] until compiler stop whining"
htafdresgihmmm, well one other thing is I was hoping could have a web interface and for it to send emails if the Ph levels were off or water levels were too low
carl0s-Ok I will try some more tonight. I got to a point where I had just totally lost track last night
carl0s-IcePic, totaly, yep, that's what I've been doing :D
pwillardhtafdresgi: then you are constrained by the lame SPI ethernet shields available...
IcePicas I said before, a function that wants a pointer will happily accept a pointer to a pointer to a pointer to an int, since that is a pointer. It will just not work as a simple ptr-to-int
IcePicthe compiler will not unscrew that for you
htafdresgipwillard: thanks
carl0s-so by telling my function to accept char *data, then that means it's accepting a pointer. so if I have an array storage[255] something, don't I then call my function with function(&storage) so that the address of storage[] it passed to the pointer argument? am i even close?
IcePicstorage[] already is a pointer
pwillardand with all that balloon deflating i just did... buy one and have fun... but just don't expect to make full use of it... ;-P And everything you mentioned can be done ona Raspberry Pi, BananaPi, <nameoffruithere>pi, or beaglebone just as well. (using Linux instead)
carl0s-well then I think lines 48 onwards here are bad, because the pointer for data is not pointing at any defined array. :
raphapwillard: a couple of friends and i were going to buy the LoFive but unfortunately missed the date :-( ... wanted it not because of the fast CPU but because of the openness
pwillardhow is arduino not open?
raphaare the 328P schematics released under an open hardware license?
carl0s-adafruit bring out Cortex M4+ based things soon
raphait can mean sooo many things that word pwillard
raphajust like "free"
pwillardeverything in ardiuno is open... unless it was made by instead of
pwillardYou have full design specs on the hardware including schematics and the IDE source code has been available since the start. So there is nothing unique about the hifive being OSH.
raphai repeat my question, what's the license of the 328P?
pwillardYou have never been to the website, have you?
carl0s-IcePic, what do you reckon? am I getting close? in the function kwpPacket getResponse(){} I initialise a kwpPacket called packet, which has char *data, but no array refernce linked to it
raphasure have
pwillardArduino is an open-source electronics platform based on easy-to-use hardware and software. Creative Commons License... since day 1
raphai mean the atmega328p
raphai know all the arduino stuff is CC
IcePiccarl0s-: <- an example of having a size 10 buffer / array and passing it around in different ways to subfunctions
pwillardYou are not making a point. The FIRMWARE in an FPGA might be open... but the FPGA itself is no different than a 328p
klineopen software, closed silicon
klinebut you can say the same about pretty much all silicon
pwillardLet china reverse engineer that FPGA silicon and someone is calling the lawyers
klinethankfully RISC-V is fixing this
klineas an open ISA there are now fosshw hdl implementations that can be used to replace other processors and in time eventually things like the AVR family
raphathat chip _is_ RISC-V
raphathat's the point i'm trying to make
carl0s-IcePic, I follow all of that thanks. i'm going to try some of it later when i'm home with the board. so I define my array and then that is passed in to the char *inarray parameter. that does make sense to me now. and I see what you mean about declaring it globally once.. I might as well for what i'm doing.
IcePiccarl0s-: when coding for a 2k ram cpu, not doing allocations over and over becomes crucial quicker than you think
carl0s-yep I understand. I have 32k and 256k flash but it's still important not to be wasteful :)
pwillardand I'm saying that sifive still owns their own chip designs. SiFive's business model is based on designing custom computer chips for other businesses. They are not giving away the farm for free. They own their designs and they just happen to use the RISC-V as way to achieve success.
raphaso why is it being touted as a FLOSS MCU then?
IcePicI think if you make a risc-v cpu (or one that runs risc-v code) they will not sue you. If you do something that looks like intels, they will
IcePicas pwillard says, they still like to sell you some of their chips, like a few million ones, but you are allowed to mimic the architecture
IcePicjust like you are allowed to mimic arduino boards or make your own boards from the eagle files on still likes to sell you theirs
pwillardthere you go
thiagofacchiniback from dinner
thiagofacchiniWhat I lost?
htafdresgiso do you figure I'd be able to do all the stuff I wanted to do (sans internet) with this $15 Uno?
htafdresgioh, I found one with the ethernet shield for same price
pwillardhtafdresgi: there are a lot of examples of getting that to work.
htafdresgiawesome thanks
carl0s-IcePic, I am trying to follow those examples for passing arrays to functions, but I am struggling with my struct initator. I could just ignore the data array part of the struct altogether and just store diretly in the global data[] but I'm concerned then about mixing request and response packets
IcePicthat paste didnt say much.
jmasseodoes it matter what type of capacitor you use for decoupling?
IcePicbut all the stuff you do for your struct, I would do with code instead
jmasseoif i'm gonna buy a cap assortment, should i get ceramic, electrolytic, film, or ???
carl0s-well in that paste, I'm kind of saying... where do I link an array e.g. inbytes[255] to char *data ?
carl0s-within the function I am saying = {0x1, 0x2, 0x3, 0x4}, but I don't have it linked to an array reference anywhere
pwillardCapacitor selection is often based on size and voltage. Decoupling is often done with ceramic.
IcePiccarl0s-: and I am saying that you should have fed 1,2,3,4 into the static buffer and not needing to update the struct at all
carl0s-IcePic, yeah, so feed it into the global data[] ?
IcePicyes, and if that one is referenced correctly, it will be used. And if it holds the correct values and gets used, you win
carl0s-but then I can never have more than one instance of kwpPacket with different data can I?
Rickta59* i'm always worried when people use the variable name data ... as that is often a pointer to the beginning of the .data segment
carl0s-not that I'm 100% sure I need that, but I may..
IcePiccarl0s-: if you do, you will need to change a lot more
carl0s-i guess I can have a outBuff[] and inBuf[]
carl0s-at the moment though I can do kwppacket response = getResponse(); and kwpPacket response2 = getResponse().. or that was the plan anyway
IcePiccarl0s-: are you coding for avr or other cpus?
carl0s-atsamd21 (arm cortex) on an Adafruit Feather M0
IcePicok, then you have more ram to play with I guess
carl0s-yeah 32kb. plus they will have the atsamd51 stuff (Cortex M4) coming out soon with even higher specs. These things are cool. lots of hardware i/o (multiple i2c master & slave, spi, u(s)art, etc.)
Rickta59the nice thing about making it a global variable carl0s- is that it will be automatically zeroed
carl0s-I think i'll try it .. with separate inbuff and outbuff storage arrays..
Rickta59or if you initialize it, it id done using the data copy code which will happen for all variables in one whack
carl0s-I can play around in the IDe here and look for errors and bits that I can't make sense of, but the board is at home so I can't test properly
raphaany of you going to be a Chaos Communication Congress this year?
YotsonDoes being stuck to a screen watching the feeds and recordings count?
YotsonComplicated way of saying 'no'... :)
raphawe'll let it sort-of count ;)
Yotsonyay. :D
YotsonYou're going rapha?
raphayes, it's in my city so this year i really have no excuse
YotsonGot something hackish for the model train track?
raphanaw i was thinking of angeling and then we'll have an assembly and before congress i have far too much to do already
raphaa float on an ATmega or ATtiny is 4 bytes big, correcT?
Rickta59so is a double rapha
rapha bah, sizeof(float) and be done with it, i don't even need to know
raphaRickta59: double is just as (im)precise as float if i understand correctly?
Rickta59they are the same size
Rickta59imprecise is relative
raphathat's why i put the parentheses there
YotsonOn AVR based chips. To be very clear. :)
Rickta59yeah on avr
raphajust talking about avr, yes
raphai don't own anything but ATmegas and ATtinys
raphawell okay there's one esp8266 in a drawer somewhere but haven't yet used it
Cheezeheadare the newer ESP32 pin and form factor compatible with the original nodemcu's? Looking at picking up a breakout/baseplate ( for one and wasn't sure if it should work
pwillardmine is different
raphaCheezehead: i recently stumbled over this: - helpful?
pwillardthe standard is that there isn't one
stationim planing to make large 7 segment clock with ntp. 40 cm diy 7 segment displays. but im new to electronics and needsome help there are already some project codes on the internet but how can I proceed  driving ex 12 v ledstrip 7X4 Segment +++
pwillardwithout more details... no idea
pwillardTell us how much current per segment might help
pwillardand for simplicity sake, you want to wire it like a common anode 7 segment display
stationimplaning tomake large 7 segment clock with ntp
station40 cm diy 7 segment displays
stationbut im new to electronics and needsome help there are already some project codes on the internet but how can I proceed  driving ex 12 v ledstrip 7X4 Segment +++
pwillardok I can comfortably ignore you now.
d3jakeAfternoon everyone
raphagood evening d3jake
pwillardGah... My mind is KuddelMuddel... 4 false starts on making a Pi Based Mame system.
d3jakeDid you try priming the pump with caffeine or ETOH?
pwillardI'll tell you what I don't like... EmulationStation, RetroPie and Retroarch. As a matter of fact... I don't have or want stupid gamecontroller from a PS2 or xbox.
pwillardI've been procaffeinating - I don't start anything unless I've had my coffee.
d3jakeheh, good man
pwillardI built a trinket based HID keyboard for extra keys... of course with those solutions mentioned... its ignored.
pwillardexit software... works fine... see... when you claim its "easy... arcade gaming with no code" and then you force me to fix the code... I feel betrayed.
pwillardI'm thinking the best solution is to just install mame4all and assume I will just need to code stuff and it will all end up working... including my capsense coin slot and extra keys like "esc" to exit the MAME emulator.
d3jakeWHat is mame4all?
pwillardMultiple Arcade Machine Emulator that works on a PI
pwillardI just want a few of the ones I played in the 1970's and 80's
d3jakeOkay. SO, is it normally broken, or is it the setup you're trying to get running?
pwillardI have a Xarcade dual "joystick"... thats the main issue.
pwillardI'm probably going to just give up and use windows XP machine.
fooman2011Hello. I'm trying to use UART on my ATTiny2313A (datasheet: I'm using this code: it works at 9600 bauds but doesn't work at 115200 bauds. The clock speed of my ATTiny2313A is 1Mhz. Could you please tell me what is wrong ?
SpeccyManmultiply 115,200 by 10 then see if you can figure it out
deskwizardlower the baud or up the clock.
fooman2011even 8Mhz doesn't solve the pb
fooman2011And 115200 is from another device. I don't have the choice about the bauds
cmf_me again :)
cmf_it's working pretty well :)
pwillardcmon fooman2011 You know this is an #avr question.
Zethhi, can someone help me with an arduino project?
Snert_ask away maybe somebody knows
fooman2011In the attiny2313A page 30. There is a schema to use an external crystal. There are 2 capacitors. Could you please tell me if they are ceramic type capacitors ?
vsmithHi All! I am just getting into Arduino and looking for good suggestions on starter kits. What are the best starter kits out there that give you the most bang for your buck? Which ones have you all used?
Yotsonfooman2011. Yes, ceramics. I don't think you can even get ~20pF electrolitics. :)
fooman2011ok thanks
vsmithI'm looking for suggestions.
IcePicany kit will have 30+ parts, of of which you are going to use 20 at most, and wonder about the 10 you didnt. Now, which 10 you and others leave will differ, so there might not be a kit that suits everyone
IcePicI would get one with a book(let) and try to follow it to the end
IcePicbut you will probably get distracted, learn enough to jump to something slightly too advanced that looks funnier and then your trek to knowledge starts
vsmithcool thanks for the advice IcePic. Is there one you have used, that you like?
kaoshavochello all
d3jakeTIL, my laptop doesn't appreciate having only 1GB active, when it usually has 5GB...
carl0s-So I have an idea / query...
carl0s-My code, ( ) has some blocking serial reads.. I am timing them, and when my incoming data is big, it adds an extra 80ms or so. also waiting for my first byte usually takes 25 - 30 ms. I want to multitask a bit better than that.. so... I'm thiking of doing the in the main loop, and re-entering the functions as and when bytes arrived ( != -1). Does this sound like a reasonable way of doing it?
carl0s-Is it going to be a bit weird to dunk in and out of functions? trying to remember how far down through the function I was ? It would be the getResponse() function (line 46 onwards), and there are quite a few different serial.reads required to complete a frame/packet.
carl0s-oh, neverind. Serial.available() was a more elegant solution :)
pwillardbasic rule: never make a serial read without reading serial available first
pwillardIE. you just cannot do then another
carl0s-pwillard yeah :) I was doing while ( = -1)... stopping time waiting for the byte
carl0s-strangely though, when encapsulating the call to getResponse() in an if (Serial.available() >0 ), well, it works fine but not for my large data packets. It's hitting a timeout for Serial.readBytes. but if I don't use the serial.available it's fine. I can't make sense of that.
carl0s-the Serial.available sholud simple be saying "packet is ready to be received and processed", but it seems like i'm tring to read it too quickly when I use that.
carl0s-ah I got it. I am sending out requests fasters than the responses are coming in/being processed.