03-09-2015, 05:29 AM
(03-08-2015, 04:23 PM)arvidj Wrote:(03-08-2015, 07:40 AM)chucketn Wrote: I'm using a HF cheap scale and an Arduino Uno. I am trying to get a display on the Serial Monitor of the Arduino IDE.
I am using the hookup and schematic from here:
http://www.instructables.com/id/Reading-...duino-USB/
The sketch displays only one 0, but the caliper is powered and working using the led and resistor circuit shown there. I think the code listed there is for a different protocol.
I am not, nor do I pretend to be, a programmer and I did not stay at a Holiday Inn last night...
Chuck
Looking at these two pages ...
http://www.instructables.com/id/Reading-...-Protocol/
http://www.yuriystoys.com/2013/07/chines...ormat.html
suggest that the instructables code is expecting to see the information protocol Yuri found coming from his HF calipers.
This leads me to believe that either (a) the level shifting bodge [his definition, not mine] from the instructables is not "level shifting" the inputs enough for your Arduino to read them or (b) the protocol being sent by your HF calipers is different than that sent by the instructables and Yuri's calipers.
To test (a) I would look thru the instructables code and see if the inputs are changing. Something like this might do it ... [note that I have note validated that this will even compile ... just that it looks nice :-}]
// Pin Declarations
int dataIn = 11;
int clockIn = 12;
void setup() {
// Pin Set Up
pinMode(dataIn, INPUT);
pinMode(clockIn, INPUT);
Serial.begin(115200);
Serial.println("Ready: ");
}
void loop(){
Serial.print("clockInValue = ");
Serial.println(digitalRead(clockIn));
Serial.print("dataInValue = ");
Serial.print(digitalRead(dataIn));
}
After you validate that the inputs are changing ... or not ... we can look at the next steps.
Arvid
Arvid, the code you posted gives all 1's for both outputs, suggesting the level shift is needed.
Chuck
Micromark 7x14 Lathe, X2 Mill , old Green 4x6 bandsaw
The difficult takes me a while, the impossible takes a little longer.
The difficult takes me a while, the impossible takes a little longer.