daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int pin1 = 11;
  2. int pin2 = 12;
  3.  
  4. class Test1 {
  5.   public:
  6.     Test1(int pin) {
  7.       _pin = pin;
  8.     };
  9.     void go(void) {
  10.       digitalWrite(_pin, 1);
  11.     };
  12.   private:
  13.     int _pin;
  14. };
  15.  
  16.  
  17. class Test2 {
  18.   public:
  19.     Test2(int pin) {
  20.       Test1 test1(pin);
  21.       _test1 = &test1;
  22.     };
  23.     void go(void) {
  24.       _test1->go();
  25.     };
  26.   private:
  27.     Test1 *_test1;
  28. };
  29.  
  30. Test1 tescik1(pin1);
  31. Test2 tescik2(pin2);
  32.  
  33. void setup() {
  34.   pinMode(pin1, OUTPUT);
  35.   pinMode(pin2, OUTPUT);
  36. }
  37.  
  38. void loop() {
  39.   tescik1.go();
  40.   tescik2.go();
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top