


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include <IRremote.h> IRsend irsend; void setup() { Serial.begin(9600); } void loop() { Serial.println("send ir signal"); irsend.sendNEC(0xFF18E7, 32); delay(100); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
/* * IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv * An IR detector/demodulator must be connected to the input RECV_PIN. * Version 0.1 July, 2009 * Copyright 2009 Ken Shirriff * http://arcfn.com */ #include <IRremote.h> int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode(&results)) { long int decCode = results.value; String hexCode = String(decCode, HEX); String decodedSignal = decodeSignal(hexCode); if(decodedSignal != "unknown") { Serial.print("dec: "); Serial.print(hexCode); Serial.print("|"); Serial.print(decCode); Serial.print("|"); Serial.print(decodedSignal); Serial.println(); } // Serial.println(, HEX); irrecv.resume(); // Receive the next value } } String decodeSignal(String hex) { hex.toUpperCase(); if(hex == "FFA25D") return "power"; if(hex == "FF629D") return "mode"; if(hex == "FFE21D") return "mute"; if(hex == "FF22DD") return "play"; if(hex == "FF02FD") return "rewind"; if(hex == "FFC23D") return "forward"; if(hex == "FFE01F") return "eq"; if(hex == "FFA857") return "-"; if(hex == "FF906F") return "+"; if(hex == "FF6897") return "0"; if(hex == "FF9867") return "repeat"; if(hex == "FFB04F") return "usd"; if(hex == "FF30CF") return "1"; if(hex == "FF18E7") return "2"; if(hex == "FF7A85") return "3"; if(hex == "FF10EF") return "4"; if(hex == "FF38C7") return "5"; if(hex == "FF5AA5") return "6"; if(hex == "FF42BD") return "7"; if(hex == "FF4AB5") return "8"; if(hex == "FF52AD") return "9"; return "unknown"; } |
1 |
An exception of type 'Microsoft.Advertising.Shared.AdException' occurred in Microsoft.Advertising.Mobile.DLL and wasn't handled before a managed/native boundary |
1 2 3 4 5 6 7 8 |
... adControl.ErrorOccurred += AdUnit_ErrorOccurred; } void AdUnit_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e) { System.Diagnostics.Debug.WriteLine("ad error "+e.Error.Message.ToString()); } |
1 |
ad error Required capabilities are missing from manifest (WMAppManifest.xml): ID_CAP_IDENTITY_DEVICE,ID_CAP_MEDIALIB. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using wp_ads.Resources; using Microsoft.Advertising.Mobile.UI; namespace wp_ads { public partial class MainPage : PhoneApplicationPage { private const string APPLICATION_ID = "test_client"; private const string AD_UNIT_ID = "Image480_80"; AdControl adControl; Grid grid; public MainPage() { InitializeComponent(); grid = (Grid)this.LayoutRoot.Children[1]; adControl = new AdControl(APPLICATION_ID, AD_UNIT_ID, true); adControl.Width = 480; adControl.Height = 80; adControl.ErrorOccurred += AdUnit_ErrorOccurred; grid.Children.Add(adControl); } void AdUnit_ErrorOccurred(object sender, Microsoft.Advertising.AdErrorEventArgs e) { System.Diagnostics.Debug.WriteLine("ad error "+e.Error.Message.ToString()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
const int buttonPin = 9; // the number of the pushbutton pin const int ledPin = 8; // the number of the LED pin const int buttonPin2 = 7; const int ledPin2 = 6; // variables will change: int buttonState = 0; // variable for reading the pushbutton status int buttonState2 = 0; void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); pinMode(ledPin2, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); pinMode(buttonPin2, INPUT); } void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); buttonState2 = digitalRead(buttonPin2); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } if (buttonState2 == HIGH) { // turn LED on: digitalWrite(ledPin2, HIGH); } else { // turn LED off: digitalWrite(ledPin2, LOW); } delay(100); } |