Comments (3)
In lin.h change this:
#define LIN_SERIAL HardwareSerial
to:
#define LIN_SERIAL SoftwareSerial
Now my software will use the SoftwareSerial object. This is only going to work if SoftwareSerial has the same member functions as HardwareSerial (I think it does but I forget).
Now in your program, construct your SoftwareSerial object, and pass it into my LIN code:
setup()
{
SoftwareSerial mySerial(2,16);
Lin myLin(mySerial, 16);
...
}
(and BTW your error is c++ conceptual, not specific to this LIN library -- study default parameters a bit more)
from lin.
Awesome. Got it to work. Thanks! Had to make a couple minor changes.
I put code you wrote about outside the setup function on my sketch, and I also had to change this:
Lin(LIN_SERIAL& ser=Serial ,uint8_t txPin=16);
to this:
Lin(LIN_SERIAL& ser,uint8_t txPin=16);
I had some luck with it. I get frame errors a lot which I am guessing is a conflict with the actual module sending a frame with the same ID I am sending. But it did work some. the response would be delayed sometimes. Guessing maybe every once in a my frame hits it just right and responds to the master before the other??
Also noticed that when I captured data with my logic analyzer, the interbyte spaces are much larger on the frames I am sending vs the frames on the LIN. Is that just a limitation of my hardware? It can only transmit so fast. I did make sure the baud was right. Both are at 19200.
from lin.
So changed set up a hardware serial again, and that seems to make the spaces smaller. however I did notice that the bits aren't quite the same duration. the 0 bits are about 62 microseconds and the 1 bits are about 42 microseconds. Wondering if that makes a difference.
Anyway, I am going to play around with it a little more tomorrow and see if I can get it to respond faster. I want to avoid intercepting the existing module that produces the same frame ID because I need that to function at all times. I could probably get away with a transistor that switched off and interrupts the LIN going to that module for just a split second while I send the frame I want.
Logic Analyzer pic.
from lin.
Related Issues (10)
- File missing HOT 9
- Add header guard to lin.h file. HOT 3
- timeout period is longer than necessary
- LIN transceiver HOT 10
- LIN response in frame
- Serial Monitor Printing
- LIN Slave HOT 1
- LIN.recv doesn't send Sync and ID frames correctly
- LIN diagnostic frames shall always use checksum calculation of protocol version 1.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lin.