SHARE
TWEET

Untitled

a guest Feb 16th, 2020 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void setup() {
  2.   pinMode(22, OUTPUT);
  3.   digitalWrite(22, 0);
  4.  
  5.   Serial.begin(115200);
  6.  
  7.   unsigned long sincePrint;
  8.  
  9.   sincePrint = millis();
  10.   for(int i = 0; i < 10000000; i++) {
  11.     digitalWrite(22, 1);
  12.     digitalWrite(22, 0);
  13.   }
  14.   Serial.print(millis() - sincePrint);
  15.  
  16.   Serial.print(" ");
  17.  
  18.   sincePrint = millis();
  19.   for(int j = 0; j < 10000000; j++) {
  20.     gpio_set_level(GPIO_NUM_22, 1);
  21.     gpio_set_level(GPIO_NUM_22, 0);
  22.   }
  23.   Serial.print(millis() - sincePrint);
  24.  
  25.   Serial.print(" ");
  26.  
  27.   sincePrint = millis();
  28.   for(int k = 0; k < 10000000; k++) {
  29.     GPIO.out_w1ts = ((uint32_t)1 << 22);
  30.     GPIO.out_w1tc = ((uint32_t)1 << 22);
  31.   }
  32.   Serial.print(millis() - sincePrint);
  33.  
  34.   Serial.print(" ");
  35.  
  36.   sincePrint = millis();
  37.   for(int k = 0; k < 10000000; k++) {
  38.     REG_WRITE(GPIO_OUT_W1TS_REG, BIT22);
  39.     REG_WRITE(GPIO_OUT_W1TC_REG, BIT22);
  40.   }
  41.   Serial.print(millis() - sincePrint);
  42.  
  43.  
  44. }
  45.  
  46. void loop() {
  47.  
  48.  
  49. }
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