當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript arduino-uno.createSinks函數代碼示例

本文整理匯總了TypeScript中@amnisio/arduino-uno.createSinks函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createSinks函數的具體用法?TypeScript createSinks怎麽用?TypeScript createSinks使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了createSinks函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: createSinks

const application = (arduino: Sources) => {
  const sinks = createSinks();
  sinks.D2$ = periodic(100).sample(arduino.D2$).map(invert);
  sinks.D3$ = periodic(250).sample(arduino.D3$).map(invert);
  sinks.LED$ = periodic(500).sample(arduino.LED$).map(invert);
  return sinks;
};
開發者ID:artfuldev,項目名稱:RIoT,代碼行數:7,代碼來源:multiple-blinks.ts

示例2: createSinks

const application = (arduino: Sources) => {
  const sinks = createSinks();
  sinks.LED$ =
    periodic(500)
      .sample(arduino.LED$)
      .map(led => led == LOW ? HIGH : LOW);
  return sinks;
};
開發者ID:artfuldev,項目名稱:RIoT,代碼行數:8,代碼來源:blink.ts

示例3: createSinks

const application = (arduino: Sources) => {
  const sinks = createSinks();
  sinks.LED$ =
    periodic(20)
      .sample(arduino.D2$)
      .map(value => value == LOW ? HIGH : LOW);
  return sinks;
};
開發者ID:artfuldev,項目名稱:RIoT,代碼行數:8,代碼來源:input-pullup.ts

示例4: createSinks

const application = (arduino: Sources) => {
  const sinks = createSinks();
  // We do some maths in order to get a stream of brightnesses that allows fading
  sinks.D10$ =
    // Create a stream that emits an event every 30 ms
    periodic(30)
      // fold it onto a stream that repeats 0 to 101 forever
      // 0-1-2-3-...-100-101-0-1-2-3-4-...->
      .fold((brightness, event) => brightness == 101 ? 0 : ++brightness, 0)
      // map it to a triangular stream that rises and falls, peaking at 51, forever
      // 0-1-2-3-...-50-51-50-...-3-2-1-0-1-2-3-...->
      .map(brightness => {
        const x = brightness % 51;
        return brightness > x ? 51 - x : x;
      })
      // map it to a stream that multiplies the value by 5, to get increments of 5, peaking at 255
      // 0-5-10-15-...-250-255-250-...-15-10-5-0-5-10-15-...->
      .map(brightness => 5 * brightness);
  return sinks;
};
開發者ID:artfuldev,項目名稱:RIoT,代碼行數:20,代碼來源:fade.ts

示例5: createSinks

const application = (arduino: Sources) => {
  const sinks = createSinks();
  sinks.LED$ = periodic(20).sample(arduino.D2$);
  return sinks;
};
開發者ID:artfuldev,項目名稱:RIoT,代碼行數:5,代碼來源:button-activated-led.ts


注:本文中的@amnisio/arduino-uno.createSinks函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。