User Tools

Site Tools


en-us_commands:reference:filo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en-us_commands:reference:filo [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:filo [2026/09/14 20:30] (current) – external edit 127.0.0.1
Line 14: Line 14:
  
 ===== Example ===== ===== Example =====
 +
 +Send ''a'' in Serial Monitor to store the next number, ''p'' to retrieve the most recently stored number, or ''c'' to clear the buffer. Send one character at a time to observe the behavior.
  
 <code cpp> <code cpp>
-uint16_t filoOut+uint16_t nextNumber = 0
-FILO(0, digitalRead(0)digitalRead(1), D[0]filoOut10);+uint16_t lastNumber = 0; 
 + 
 +void setup() { 
 +  Serial.begin(115200); 
 +
 + 
 +void loop() { 
 +  if (!Serial.available()) return; 
 +  const char action = Serial.read(); 
 +  const bool store = action == 'a'; 
 +  const bool retrieve = action == 'p'; 
 +  const bool clearBuffer = action == 'c'; 
 +  if (store) ++nextNumber; 
 + 
 +  const bool ok = FILO(0, storeretrieve, nextNumber, lastNumber, 16, clearBuffer);  // Store a number; on a pop signalretrieve the last stored number. 
 +  FILO(0, falsefalse, nextNumber, lastNumber, 16, false);  // Return both inputs to LOW so the next character creates a new rising edge. 
 +  if (retrieve && ok) Serial.println(lastNumber); 
 +  if (retrieve && !ok) Serial.println(F("Buffer empty")); 
 +}
 </code> </code>
  
Line 23: Line 43:
  
 ''IN'', ''OUT'', ''CU'' and ''CD'' act on rising edges. Use a unique ''id'' for each counter or buffer, and keep ''size'' to the required minimum. ''IN'', ''OUT'', ''CU'' and ''CD'' act on rising edges. Use a unique ''id'' for each counter or buffer, and keep ''size'' to the required minimum.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:fifo|FIFO() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/filo.1788785565.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki