# Lua - Receive Midi

**URL:** <https://forum.electra.one/t/lua-receive-midi/1176>\
**Category:** Developers\
**Created:** [December 4, 2021, 10:28am UTC](https://forum.electra.one/t/lua-receive-midi/1176 "2021-12-04T10:28:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RobinC](https://avatars.discourse-cdn.com/v4/letter/r/aeb1de/32.png) [@RobinC](https://forum.electra.one/u/RobinC)\
**Post date:** [December 4, 2021, 10:28am UTC](https://forum.electra.one/t/lua-receive-midi/1176/1 "2021-12-04T10:28:14Z")

</div>

I’m currently using Electra to control various functions of Logic Pro X

Am using Pitchbend to map to fader volume using a suggestion from this thread

> [@Pitchbend](https://forum.electra.one/t/pitchbend/1149/3):
>
> For the time being - @RobinC I do that with a Lua function: function handle\_slider (valueObject, value) local control = valueObject:getControl() local id = control:getId() local channel = id % 6 local pitch = math.floor( (value \* 16383)/100 ) - 8192 midi.sendPitchBend (PORT\_1, channel, pitch) end Then assign handle\_slider to a virtual parameter slider set values 0 to 100. Maybe this can help you.

This works but I want to sync feedback from Logic to electra so when switching channels the virtual control on electra is set to the correct value

Using Lua - what do I need to look at to interrogate incoming MIDI messages ? Do I then update the Parameter map with my value or do I update the control directly (does updating the parameter map automatically update the control ?)
