void setup()
{
Serial.begin(9600);
pinMode(A1, INPUT); //data line //Yellow cable
pinMode(A0, OUTPUT); //SCK line //Orange cable
}
void loop()
{
for (int j = 0; j < 10; j++)
{
digitalWrite(A0, LOW);//SCK is made LL
while (digitalRead(A1) != LOW) //wait until Data Line goes LOW
;
{
for (int i = 0; i < 24; i++) //read 24-bit data from HX711
{
clk(); //generate CLK pulse to get MSB-it at A1-pin
bitWrite(x, 0, digitalRead(A1));
x = x << 1;
}
clk(); //25th pulse
Serial.println(x, HEX);
y = x;
x = 0;
delay(1000);
}
dataArray[j] = y;
}
Serial.println("===averaging process=========");
unsigned long sum = 0;
for (j = 0; j < 10; j++)
{
sum += dataArray[j];
}
Serial.print("Average Count = ");
sum = sum / 10;
Serial.println(sum, HEX);
}
My question can any other Digital pins be selected instead of A0 and A1?
As further in the snippet above digitalRead and digitalWrite is executed.
Let's assume that you have a Arduino Uno boards version R3. Then every pin is a digital pin. Pin 0 and 1 are used for the serial monitor and to upload a sketch, so you better not use those.
Are you trying to make code without a library for the HX711 ?
Most pins can be used for a number of different things.
Can you look into the future to see what else you want to add ?
Pin 2 and 3 are used for interrupts with a rotary encoder. Pin A4 and A5 are the I2C bus for sensors. The PWM pins are sometimes used for motors and leds. The analog pins can be used to measure a analog signal. And then there is also a SPI bus when you want to add a SD card.
I didn't think it looked that bad. If you take in to count the person/s did not write the code. he/she could have addressed the person/s by name of reference to using of code snippets.
Gates:
I didn't think it looked that bad. If you take in to count the person/s did not write the code. he/she could have addressed the person/s by name of reference to using of code snippets.
The idea is not to offend anybody. I have utmost respect and awe of senior members. To set the record right this code was given by a Faraday member @ GolamMustafa
I may be excused.
Gates:
I didn't think it looked that bad. If you take in to count the person/s did not write the code. he/she could have addressed the person/s by name of reference to using of code snippets.
Let's assume that you have a Arduino Uno boards version R3. Then every pin is a digital pin. Pin 0 and 1 are used for the serial monitor and to upload a sketch, so you better not use those.
Are you trying to make code without a library for the HX711 ?
Most pins can be used for a number of different things.
Can you look into the future to see what else you want to add ?
Pin 2 and 3 are used for interrupts with a rotary encoder. Pin A4 and A5 are the I2C bus for sensors. The PWM pins are sometimes used for motors and leds. The analog pins can be used to measure a analog signal. And then there is also a SPI bus when you want to add a SD card.
Thanks @Koepel. I will keep in mind this information..