This example demonstrates the use of an M5S digital output module (M5S-BOT05750D1b) to switch a load with a maximum voltage of 24 V DC and a maximum current of 750 mA. It writes a HIGH / LOW value to a digital pin using the digitalWrite function and prints the value to the Serial Monitor.


The circuit

  • External: M5S digital output module switching a load with a maximum voltage of 24 V DC and a maximum current of 750 mA.
  • Internal: M5S digital output module connected to Arduino digital pin 3.

 Schalten einer Last mit maximaler Spannung von 24 V DC und einem maximalen Strom von 750 mA. M5S 2 verbunden mit Arduino Digital-Pin 3.


Characteristics of different output modules

  • M5S-BOT05750D1b
    Arduino value 0 (LOW)  -> Arduino pin voltage 0 V -> M5S ON  -> M5S output Uext
    Arduino value 1 (HIGH) -> Arduino pin voltage 5 V -> M5S OFF -> M5S output passive
  • M5S-BOT05750C1b
    Arduino value 0 (LOW)  -> Arduino pin voltage 0 V -> M5S ON  -> M5S output GND
    Arduino value 1 (HIGH) -> Arduino pin voltage 5 V -> M5S OFF -> M5S output passive


Code

void setup() {  
  Serial.begin(9600); // start serial connection  
  pinMode(3, OUTPUT); // configure pin 3 as an output
}

void loop() {
  writeAndPrint(HIGH); 
  delay(1000);         // wait 1 second
  writeAndPrint(LOW);  
  delay(3000);         // wait 3 seonds
}

void writeAndPrint(int value) {
  digitalWrite(3, value); // write the value to pin 3  
  Serial.println(value);  // print the value to the Serial Monitor
}

This example code is based on the Arduino standard sample:
http://www.arduino.cc/en/Tutorial/InputPullupSerial