XOR function

18 Feb 2013

Good Day all

Since I am new to the programming language and mbed world, is possible to use xor function with mbed.

Simply I feed a square wave signal to the mbed and I need to Xor the signal. is that possible?

If yes, where can I find the code?

thanks in advance

18 Feb 2013

Hi Majed,

There are some examples of logical functions on the DigitalIn handbook page if they are useful:

Boolean logic - NOT, AND, OR, XOR

#include "mbed.h"
 
DigitalIn a(p5);
DigitalIn b(p6);
DigitalOut z_not(LED1);
DigitalOut z_and(LED2);
DigitalOut z_or(LED3);
DigitalOut z_xor(LED4);
 
int main() {
    while(1) {
        z_not = !a;
        z_and = a && b;
        z_or = a || b;
        z_xor = a ^ b;
    }
}

Simon

20 Feb 2013

thanks Simon

I will try to use them, hopefully I can do the task