Skip to content

Commit

Permalink
update library decoding two complemennt
Browse files Browse the repository at this point in the history
  • Loading branch information
pim12345 committed Jun 28, 2020
1 parent b13c137 commit 9499346
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library_code/hx711.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ int hx711::read(){
int result = 0;
for(int k=0; k<24; k++){

if(array_bits[k] == 1 && k < 8){
int macht = pow((k+1), 2);
if(array_bits[k] == 1 && k == 0){
int macht = pow((24), 2);
result = result - (macht * 1);
hwlib::cout << "result- " << result << hwlib::endl;
}
if (array_bits[k] == 1){
else if (array_bits[k] == 1){
int macht = pow((k+1), 2);
result += (macht * 1);
hwlib::cout << "result+ " << result << hwlib::endl;
Expand Down

0 comments on commit 9499346

Please sign in to comment.