どうやったら良いのか分からなかったのでググったらQiitaにGoogle-code-prettifyというのがあったので、早速実験!
無事実行成功! ただ、これだけでは足りなかったので、以下のCSS(元のページ)を追加して、max-heightを加えて縦横スクロールを追加。
これでやっとやりたいことが出来るようになった、、、。
無事実行成功! ただ、これだけでは足りなかったので、以下のCSS(元のページ)を追加して、max-heightを加えて縦横スクロールを追加。
これでやっとやりたいことが出来るようになった、、、。
/*
Google code-prettify
*/
pre.prettyprint
{
border: 1px solid #cccccc !important;
line-height: 1.5em;
overflow: auto;
width: auto;
max-height: 600px;
padding: 2em !important;
}
pre.prettyprint > ol.linenums
{
padding-left: 2em;
}
pre.prettyprint > ol.linenums > li
{
border-left: 1px solid #cccccc;
margin-bottom: 0;
}
pre.prettyprint > ol.linenums > li.L0,
pre.prettyprint > ol.linenums > li.L1,
pre.prettyprint > ol.linenums > li.L2,
pre.prettyprint > ol.linenums > li.L3,
pre.prettyprint > ol.linenums > li.L4,
pre.prettyprint > ol.linenums > li.L5,
pre.prettyprint > ol.linenums > li.L6,
pre.prettyprint > ol.linenums > li.L7,
pre.prettyprint > ol.linenums > li.L8,
pre.prettyprint > ol.linenums > li.L9
{
list-style-type: decimal;
}
pre.prettyprint > ol.linenums > li.L1,
pre.prettyprint > ol.linenums > li.L3,
pre.prettyprint > ol.linenums > li.L5,
pre.prettyprint > ol.linenums > li.L7,
pre.prettyprint > ol.linenums > li.L9
{
background-color: transparent;
}
pre.prettyprint > ol.linenums > li span:first-child
{
padding-left: 1em;
}
pre.prettyprint > ol.linenums > li span:last-child
{
padding-right: 1em;
}
/* plain text */
pre.prettyprint .pln { color: #cccccc; }
/* string content */
pre.prettyprint .str { color: #cccc33; }
/* a keyword */
pre.prettyprint .kwd { color: #00cc00; }
/* a comment */
pre.prettyprint .com { color: #cc3366; }
/* a type name */
pre.prettyprint .typ { color: #00cc00; }
/* a literal value */
pre.prettyprint .lit { color: #3399cc; }
/* punctuation, lisp open bracket, lisp close bracket */
pre.prettyprint .pun,
pre.prettyprint .opn,
pre.prettyprint .clo
{ color: #cccccc; }
/* a markup tag name */
pre.prettyprint .tag { color: #3399cc; }
/* a markup attribute name */
pre.prettyprint .atn { color: #00cc00; }
/* a markup attribute value */
pre.prettyprint .atv { color: #cccc33; }
/* a declaration; a variable name */
pre.prettyprint .dec,
pre.prettyprint .var
{ color: #00cc00; }
/* a function name */
pre.prettyprint .fun { color: #cc66cc; }
/* Deep Sleep with External Wake Up ===================================== This code displays how to use deep sleep with an external trigger as a wake up source and how to store data in RTC memory to use it over reboots This code is under Public Domain License. Hardware Connections ====================== Push Button to GPIO 33 pulled down with a 10K Ohm resistor NOTE: ====== Only RTC IO can be used as a source for external wake source. They are pins: 0,2,4,12-15,25-27,32-39. Author: Pranav Cherukupalli*/ #include "esp_deep_sleep.h" #define BUTTON_PIN_BITMASK 0x8004 // GPIOs 2 and 15 //#define BUTTON_PIN_BITMASK BIT64(GPIO_NUM_34)|BIT64(GPIO_NUM_36)// GPIOs 34 and 36 unsigned long time0; unsigned long time1; RTC_DATA_ATTR int bootCount = 0; /* Method to print the reason by which ESP32 has been awaken from sleep */ void print_wakeup_reason(){ time0 = micros(); esp_sleep_wakeup_cause_t wakeup_reason; wakeup_reason = esp_sleep_get_wakeup_cause(); switch(wakeup_reason) { case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); break; case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break; case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break; case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break; case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break; default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break; } time1 = micros(); Serial.print("==>print_wakeup_reason() : "); Serial.println( time1 -time0 ); } /* Method to print the GPIO that triggered the wakeup */ void print_GPIO_wake_up(){ time0 = micros(); int GPIO_reason = esp_sleep_get_ext1_wakeup_status(); time1 = micros(); Serial.print("GPIO that triggered the wake up: GPIO "); Serial.print( GPIO_reason ); Serial.print( " : " ); Serial.println((log(GPIO_reason))/log(2), 0); Serial.print("==> print_GPIO_wake_up() : "); Serial.println( time1 - time0 ); } void setup(){ Serial.begin(115200); delay(1000); //Take some time to open up the Serial Monitor //Increment boot number and print it every reboot ++bootCount; Serial.println("Boot number: " + String(bootCount)); // Following 4 lines from http://wakwak-koba.hatenadiary.jp/entry/20170219/p1 // to make deep sleep to 4 micro amp consumption, otherwise 27 micro amp? esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF); esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF); esp_deep_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF); esp_deep_sleep_pd_config(ESP_PD_DOMAIN_MAX, ESP_PD_OPTION_OFF); //Print the wakeup reason for ESP32 print_wakeup_reason(); //Print the GPIO used to wake up print_GPIO_wake_up(); /* First we configure the wake up source We set our ESP32 to wake up for an external trigger. There are two types for ESP32, ext0 and ext1 . ext0 uses RTC_IO to wakeup thus requires RTC peripherals to be on while ext1 uses RTC Controller so doesnt need peripherals to be powered on. Note that using internal pullups/pulldowns also requires RTC peripherals to be turned on. */ //esp_deep_sleep_enable_ext0_wakeup(GPIO_NUM_15,1); //1 = High, 0 = Low //If you were to use ext1, you would use it like esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK,ESP_EXT1_WAKEUP_ANY_HIGH); //Go to sleep now Serial.println("Going to sleep now"); delay(1000); esp_deep_sleep_start(); Serial.println("This will never be printed"); } void loop(){ //This is not going to be called }
0 件のコメント:
コメントを投稿