Can the Analog pins be used as digital I/Os

I see that the Intel Curie module has a lot more I/O’s as per the datasheet :

The sensor subsystem : 16 GPIO
Host subsystem : 32 GPIO

so in total it has 48 GPIO’s.

However the Arduino 101 has exposed only 22 I/O’s, 6 of this are desginated as analog in’s (A0 to A5).

My question is are these 6 analog pins hardwires as analog inputs or can they be configured as digital I/O via the firmware?

For a particular project I needed more I/O’s and so looking if I can use these analog pins as digital I/O’s.

TIA

They can also be used as digital pins too by using "digitalWrite" and "digitalRead"

They will give a HIGH or LOW status in read mode and can be set to HIGH or LOW in write status

A little more detail here

ballscrewbob:
They can also be used as digital pins too by using "digitalWrite" and "digitalRead"

They will give a HIGH or LOW status in read mode and can be set to HIGH or LOW in write status

A little more detail here

That's wonderful to hear. On the page you linked to, there is this following statement..

Consequently, if a user needs more general purpose input output pins, and all the analog pins are not in use, the analog pins may be used for GPIO.

Thanks for sharing!!!

The PWM pins are also very versatile just by swapping from one mode to another mid sketch.

I do that in this sketch for fan 1

ballscrewbob:
The PWM pins are also very versatile just by swapping from one mode to another mid sketch.

I do that in this sketch for fan 1

For some reason I'm getting an error when I try to open that link as under

It's just one of those days. We're doing our best to get things back up and running.
If this is taking too long you can write us on the Forum, or check the Error Log.

Odd as it works here ?

JIC its still broken

  // Three stage small extractor fan
  // GAS sensor output pin to Arduino analog A0 pin
  // PWM pins used to drive fans to allow tickover speeds and prevent back flow
  
  
  #define F1 5        // Define DIGITAL pin for Fan 1
  #define F2 6        // Define DIGITAL pin for Fan 2
  #define F3 9        // Define DIGITAL pin for Fan 3
  #define MQ2 A0      // Define ANALOG pin for MQ sensor
  #define gasadj A1   // Define trim pot
  #define Alarm 4     // Define DIGITAL pin for buzzer
  
  int lgl1 = 18;      // lower gas level for Fan 1
  int lgl2 = 21;      // upper gas level for fan 1
  int mgl1 = lgl2;    // lower gas level for fan 2
  int mgl2 = 26;      // upper gas level for fan 2
  int hgl1 = mgl2;    // lower gas level for fan 3
  int hgl2 = 254;     // upper gas level for fan 3
  int gaslevel;       // blank holder
  int settle = 5000;  // Allow settle time to be set here
  int gaschange;      // will be used as a trim adjustment factor
  int tick = 75;     // set tickover speed
  
  void setup()
  {
    
  Serial.begin(9600);   // Initialize serial port - 9600 bps
  pinMode(MQ2,INPUT);   // MQ pin set
  pinMode(F1,OUTPUT);   // Fan 1 pin set
  pinMode(F2,OUTPUT);   // Fan 2 pin set
  pinMode(F3,OUTPUT);   // Fan 3 pin set
  pinMode(Alarm,INPUT); // Alarm pin set
  _delay_ms (10000);    // MQ Heater warm up can be changed to suit.

TCCR0A = _BV(COM0A1) | _BV(COM0B1) | _BV(WGM01) | _BV(WGM00); // Used to reduce motor harmonics
TCCR0B = _BV(CS01); // Used to reduce motor harmonics from PWM
OCR0A = 180;        // Used to reduce motor harmonics from PWM
OCR0B = 180;        // Used to reduce motor harmonics from PWM

    //set up for spreadsheet output
    Serial.println("ClearRange,A,2,d,5000"); // Used to set up PLX-DAQ v2.1
    Serial.println("ROW,SET,2");            //
    Serial.println("LABEL,Date.,Time.,GAS,Trim%");
    
  }
  
  void loop()
  
  {
    dotrim;

    gaslevel = (analogRead(MQ2));           // Get Gass level
    gaslevel = map(gaslevel,0,1023,0,255);  // Map gas range

             Serial.println((String) "DATA,DATE,TIME," + (gaslevel));//+","+(gaschange)); 
        
    _delay_ms(settle);
   if ( gaslevel > lgl1 && gaslevel <= lgl2 ) 
   {                          // If gaslevel is greater than 20 and less than 30 turn on Fan 1
      analogWrite (F1,tick);  // Fan 1 TICK
      digitalWrite (F2,LOW);  // FAN 2 OFF
      _delay_ms (settle*2);   // Fan settle time extended
      digitalWrite (F3,HIGH); // Fan 3 ON
      _delay_ms (settle);
      
    }
    
    else if ( gaslevel > mgl1 && gaslevel <= mgl2 ) 
    {                             // If gaslevel is greater than 30 and less than 60 Turn on Fan 1 and 2
          analogWrite (F1,tick);  // Fan 1 TICK
          _delay_ms (settle*3);   // Fan settle time extended
          digitalWrite (F2,HIGH); // Fan 2 ON
          digitalWrite (F3,HIGH); // Fan 3 ON
      
        }
        
         else if (gaslevel > hgl1  && gaslevel <= hgl2 ) 
         {                         // IF gaslevel is greater than 60 and less than 90 turn all fans on   && gaslevel <= hgl2
          digitalWrite (F1,HIGH);  // Fan 3 ON
          digitalWrite (F2,HIGH);  // Fan 2 ON
          digitalWrite (F3,HIGH);  // Fan 1 ON
          _delay_ms (settle * 4);  // Fan settle time extended
         if (gaslevel>=100)  {tone (9,900,1000) ;} // Alarm on 
         if (F3==LOW) {noTone(9);}
        }
        
        else
        
        {
           analogWrite (F1,tick);   // Fan 1 TICK
           digitalWrite (F2,LOW);   // Fan 2 OFF
           digitalWrite (F3,LOW);   // Fan 3 OFF
           _delay_ms (settle);      // Fan settle time
        }
        
  }
  
void dotrim()   // insert call to here from above
{
     gaschange = (analogRead (gasadj));         // read pot to adjust levels
     gaschange = map(gasadj,0,1023,-20,20);     // mappedValue = +-20
     lgl1=lgl1+gaschange;lgl2=lgl2+gaschange;   // add to levels
     mgl1=mgl1+gaschange;mgl2=mgl2+gaschange;   //
     hgl1=hgl1+gaschange;                       // add to gas levels

}

ballscrewbob:
The PWM pins are also very versatile just by swapping from one mode to another mid sketch.

I do that in this sketch for fan 1

So you seem to be writing analog values to the pin and sometimes digital values so either a PWM is outputed or a continuous value on that F1 pin, right? or am I missing something?

Thats correct.