I am working with simple Micropython with Esp8266 module and not able to detect if flash button on esp is pressed
I tried using pin 0 but it is not working.
p2=Pin(0,Pin.IN)
while True:
print(p2.value())
if p2.value():
break;
I also tried this but it is also not working as expected.
p2 = Pin(0,Pin.PULL_DOWN)
while True:
print(p2.value())
if p2.value():
break;
I just solved my problem.
here it is how i able to detect flash button on esp
flash_btn = Pin(0, Pin.IN, Pin.PULL_UP)
Related
I am currently working on Wes Bos' JavaScript 30 project, and in this drumkit project, I was hoping to add to his finished code by allowing user to click on the button rather than only through 'keydown' event.
After adding to the playSound function to detect
event.path[1].dataset.key || event.path[0].dataset.key
so that the click event would be able to grab the button's attribute, which contains the keyCode, and use that to detect which audio to play. Then I wrote this:
window.addEventListener('click', playSound);
and it worked great on desktop, it also worked great on my android smart phone, but for some reason the button doesn't work on an iphone.
So after looking through some similar results on stackoverflow, here's what I've tried:
window.addEventListener('touchstart', playSound)
and
window.addEventListener('DOMContentLoaded', (event) => {
window.addEventListener('touchstart', playSound)
});
but neither of them seems to work on iphone. Is there something special about iphone that doesn't allow me to click a button using their touch screen? Android doesn't seems to have this issue at all.
it turns out all i needed to do is use document.addEventListener instead of window.addEventListener for iOS
I am working on an application to be used on a windows tablet.
I have been playing around with the gesture manager and i have linked it to my rzComboBox. On the onGesture event of the combo box i have:
if EventInfo.GestureID = sgiDown then
ShowMessage('CB Down')
else if EventInfo.GestureID = sgiUp then
ShowMessage('CB Up');
The problem i am having is it only seems to hit the ShowMessages whenever i make a gesture on the closed combobox and not when i make a gesture on the dropped down part of the combo box.
Any help would be much appreciated
Hi am making a game for Windows PC using XNA and I want to check when the game window cross "X" is clicked, so I can instead draw a menu and do other stuff instead of the game closing.
So yea, how can I check when the cross is clicked.
Thanks!
There is nothing special needed for XNA, you can do this the same way as you could without it.
In your Initialize or LoadContent method need to find the Windows form reference your game is using, and add a Closing event to it.
Form form = Form.FromHandle(Window.Handle) as Form;
form.FormClosing += OnClosing;
Then using this OnClosing method, you can cancel the close event, and run your own menu screen. (Probably by changing the game state and drawing something else)
void OnClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
ShowMenuScreen();
}
I am using Flash Pro cs6, AS3, Air3.8.. And I am using textfield for input. I am trying to make it so when the user presses "Done" it shifts to the next field. I am finding conflicting information about this on all the forums, including this one. I did search but never found a fix..
I am definitely receiving the events, and I tried adding a line that identifies the keycode, which has confirmed it is receiving keycode 13. I actually made it put the keycode into the field I want the focus to shift to successfully.. It just refuses to put focus on that field..
The code I am using is stated in the docs that it will not work in iOS.. BUT it DOES work further along on the same page of script, as well as on two other ones... I have:
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyhandler);
function keyhandler(event:KeyboardEvent){
if(event.charCode == 13)
{
stage.removeEventListener(KeyboardEvent.KEY_DOWN,keyhandler);
stage.focus = null;
stage.focus = nextTextField;
}
}
I tried that while adding the listener to the text field first, then changed it to the stage, neither work.. I tried "requestsSoftKeyboard" and several other ways I have seen posted that supposedly work in iOS, but they didn't work.. There are other functions that use the same stage.focus to null, followed by stage.focus to MyTextField and they work, but they are initiated by pressing a button on the stage, NOT a button on the soft keyboard. The code there that works is just a standard if statement:
if (TextField == "")
{
stage.focus=null;
stage.focus=TextField;
}else if (NextTextField == "")
{
stage.focus = null;
stage.focus = NextTextField;
}else if (TextFieldAfterThat == "")
{
stage.focus = null;
stage.focus = TextFieldAfterThat;
}
That continues through all fields and always goes to the right one with the soft keyboard open, cursor blinking, and ready to type.. every time. I know the listeners are received from the soft keyboard "Done" because a function to capitalize the words works, and when I added code to confirm the keycode it worked. I also have found access to that value using "charcode" AND "keycode".. I do not know what the difference is, but both returned 13 and neither worked for me..
There is another place I use the same code to make a TextField active and set the focus after the user presses a radio button, and those all work every time.
I am not sure what the difference is coming from pressing "Done" vs. pressing an object on the stage, but it refuses to set the focus with the done button.
Anyone have any ideas or made this work before?
I had success assingning focus to a StageText in iOS like this:
stageText.assignFocus();
StageText offers many advantages over TextField because it shows a native text input. The only disadvantage I know is that you can't use custom fonts.
Here's the documentation, and a tutorial.
I haven't experimented with the "Done" key, but I did what you are trying to achieve with "Enter" key and it worked. Also take note that in iOS the "Done" key is meant to hide the keyboard, so that could be why you are having these problems..
With component FPTextField you can listen to the event click DONE. In this video, compared StageText and FPTextField: http://www.youtube.com/watch?v=BKYaoLtEmCU
Use ane library FPNativeUI: http://flashpress.ru/blog/ane/native-ui/?lang=en
I have two display monitors connected to my pc.
I am using DirectX 10. I have a basic app, when I press space button I call;
swapChain->SetFullscreenState(true, 0);
to make it fullscreen.
It works well on my main monitor, but when I move the app to other monitor and press space button it does not work. Also throws first-chance exception.
Is it enough to just call SetFullscreenState function ? Or do I have to make sth else ?
Thanks for help.
Edit : I solved this problem.
You must assign your monitor to an IDXGIOutput type variable and pass it to SetFullscreenState function as second parameter.
swapChain->SetFullscreenState(true, &curr_monitor);